gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sun Aug 2 14:52:25 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/efc34b24 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a9f79cf7 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/1f592ce1 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/2be2ff8a (commit)
	 via  https://github.com/Gnucash/gnucash/commit/0da826f3 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/85515214 (commit)
	from  https://github.com/Gnucash/gnucash/commit/ea2d89fa (commit)



commit efc34b247f4caa611b8967ee5e233ef3a94e155b
Merge: ea2d89fac a9f79cf79
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Aug 2 11:20:50 2020 -0700

    Merge Jean Laroche's  'improve_ofx_import_speed' into maint.

commit a9f79cf79c6b681428eaee78a5bca8f192e33b98
Author: jean <you at example.com>
Date:   Tue Jul 21 13:39:26 2020 -0700

    Add a flag to the account structure to defer balance computation

commit 1f592ce1914f1db3f9845f5e8898a413cafb1794
Author: jean <you at example.com>
Date:   Tue Jul 21 12:19:28 2020 -0700

    Fix FOO and move deletion where it should be

commit 2be2ff8af452e887db29f41235238aad2f2ce77c
Author: jean <you at example.com>
Date:   Sun Jul 19 23:02:53 2020 -0700

    To further increase the import speed, it's necessary to prevent any account commit to happen
    until the very end of the import (OK or Cancel), because account commits trigger very lengthy balance
    computations. For this, I call xaccAccountBeginEdit on all the accounts involved in the import,
    keeping a list of them so BeginEdit is called only once. At the end of the import, commit is called
    on all the accounts in the list. Note that when the user selects a target account for an imported
    transaction, xaccAccountBeginEdit is called on the target account, and it is added to the list.
    
    Another area of improvement is avoiding re-checking all register transactions to verify whether
    a given imported transaction has already been matched. Instead, a hash table of split online IDs
    is computed once (per account), and verified for each incoming transactions.
    
    Finally, the list of register transactions that are potential matches for the imported ones is
    further pruned ahead of time to only keep transactions that do not have an online ID. This avoid
    the repeated checks that were previously happening in the match-score loop.
    
    With this, importing 6000 transactions into a 6000 split account becomes fairly fast (a few seconds
    on my slowish machine).
    
    There are still slow areas: If you select all 6000 imported transactions and assign a destination
    account to all of them, the process is impossibly sluggish because of repeated path operations
    (selections, freeing) in the tree view.
    If you do not specify a target account for any of the 6000 imported transactions, an "imbalance"
    account is used, but the xaccAccountBeginEdit mechanism isn't applied to it by the new code, so
    each imported transaction will trigger a commit, and therefore a slow balance recomputation.
    
    Remove use of xaccTransGetSplit

commit 0da826f31161fd51ca45b3a6274cae37282fa9b0
Author: jean <you at example.com>
Date:   Fri Jul 17 18:52:01 2020 -0700

    Instead of saving the imported transaction into the treeview, which takes more time
    I now save them into a temporary list. A single query is done for all imported transactions
    and the resulting register splits are put into a hash table of lists with accounts
    as key, which will speed things up when multiple accounts are found.
    My tests of large imports on large accounts seems to ate that most of the time is spent
    verifying whether the imported transactions has already been imported, then computing
    the balance repeatedly for each imported transaction (!)  when the user clicks OK to
    add all the transactions to the account. So there's still room for improvement here!

commit 85515214767cbafd7489d4edebe2dbce49c5d61f
Author: jean <you at example.com>
Date:   Mon May 11 22:19:35 2020 -0700

    Speeds up the import of ofx files by only doing one query at the end.
    
    The previous ofx import code performed one query for each imported transactions, which
    was quite slow. The change consists of gathering all ofx transactions before doing the
    query. The query must be wider to search for all matching accounts (in case the imported
    transactions come from different accounts) and an enlarge date range (according to the
    earliest and latest imported transaction). The rest of the code is identical to what was
    done before. The final query is performed just before the matching dialog is displayed.



Summary of changes:
 gnucash/import-export/import-backend.c             | 120 ++++--------
 gnucash/import-export/import-backend.h             |  34 +---
 gnucash/import-export/import-main-matcher.c        | 209 ++++++++++++++++++---
 .../import-export/test/gtest-import-backend.cpp    |   7 +
 libgnucash/engine/Account.cpp                      |  25 ++-
 libgnucash/engine/Account.h                        |  15 +-
 libgnucash/engine/AccountP.h                       |   1 +
 libgnucash/engine/mocks/gmock-Transaction.cpp      |   7 +
 libgnucash/engine/mocks/gmock-Transaction.h        |   1 +
 9 files changed, 286 insertions(+), 133 deletions(-)



More information about the gnucash-patches mailing list