After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 573229 - Income Statement (Profit & Loss) report is slow to render
Income Statement (Profit & Loss) report is slow to render
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Reports
git-master
Other Mac OS
: Normal minor
: ---
Assigned To: Andreas Köhler
Andreas Köhler
Depends on:
Blocks:
 
 
Reported: 2009-02-26 06:16 UTC by Mike Alexander
Modified: 2018-06-29 22:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to speed up Profit & Loss report (and others?) (12.08 KB, patch)
2009-02-26 06:23 UTC, Mike Alexander
committed Details | Review

Description Mike Alexander 2009-02-26 06:16:32 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.
Comment 1 Mike Alexander 2009-02-26 06:23:38 UTC
Created attachment 129547 [details] [review]
Patch to speed up Profit & Loss report (and others?)
Comment 2 Charles Day 2009-04-08 03:59:17 UTC
Fix committed in r17988. Targeting for release 2.3.x.
Comment 3 John Ralls 2018-06-29 22:18:46 UTC
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.