GNOME Bugzilla – Bug 573229
Income Statement (Profit & Loss) report is slow to render
Last modified: 2018-06-29 22:18:46 UTC
On my moderately fast machine with my rather large data file the Profit & Loss report took about 4 minutes to render. I made a few changes with cut this down to about 5 seconds. These changes will probably help other reports too since they were in the report infra structure rather than in this particular report. One set of changes speeds up the three functions in report-utilities.scm gnc:account-get-comm-balance-interval gnc:accountlist-get-comm-balance-interval gnc:accountlist-get-comm-balance-at-date These can all be implemented as calls to gnc:account-get-trans-type-balance-interval (with a minor change to it to ignore the type parameter if it is #f) and it is much faster since it does a single query instead of a loop over an account list. The other set of changes is in gnc:html-acct-table-add-accounts! in html-acct-table.scm. This functions starts off by building a hash table of account balances it cares about. The code to do this did a recursive loop over the relevant accounts. I changed it to do a query to find the splits in the accounts it cares about and build the hash table from them. This speeds it up by a couple of orders of magnitude. I'll attach a patch. I think it is ok, but I would appreciate it if someone else could give it a try and see if it breaks anything they use.
Created attachment 129547 [details] [review] Patch to speed up Profit & Loss report (and others?)
Fix committed in r17988. Targeting for release 2.3.x.
GnuCash bug tracking has moved to a new Bugzilla host. This bug has been copied to https://bugs.gnucash.org/show_bug.cgi?id=573229. Please update any external references or bookmarks.