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 649933 - Creating cash flow report takes a long time
Creating cash flow report takes a long time
Status: RESOLVED FIXED
Product: GnuCash
Classification: Other
Component: Reports
2.4.x
Other Mac OS
: Normal normal
: ---
Assigned To: gnucash-reports-maint
gnucash-reports-maint
Depends on:
Blocks:
 
 
Reported: 2011-05-11 04:34 UTC by Caleb Mattoon
Modified: 2018-06-29 22:57 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Caleb Mattoon 2011-05-11 04:34:45 UTC
Summary: Recently I upgraded from an old gnucash installed via fink to new version r20417 installed from disk image on Mac OS.  With the new version, I find that creating a cash flow report takes much longer than I expect.

Description: I often use the 'Cash Flow' report to check spending by month or quarter. After upgrading to r20417, creating a new cash flow report (from Reports/Income & Expense menu) takes 2-3 minutes. Once the report is created, I can change the report options and update fairly quickly (few seconds). If I close the report and create a new one, however, it takes several minutes again.

This also shows up when I start gnucash: I usually save two cash flow reports as tabs in the 'top level' of the GUI window, tracking spending for current and previous months. I'm only tracking a few bank accounts with these reports, but still during startup the progress bar shows two separate reports being created, each taking 2-3 minutes!

Is the report indexing all account data before selecting only transactions with my selected dates?  If so, shouldn't that index be created only once, the first time in a session that a report is created?
Comment 1 Christian Stimming 2011-05-11 07:34:11 UTC
I'm sorry for this bug. I don't see such a behaviour on Linux. As for your questions: No, there is no sort of "indexing" of the account data. Instead, opening any report the very first time and running it a second time after changing some options should execute the exact same program code again. For that reason, I also don't understand your observed time delay in the beginning but no longer a time delay after changing some options.

Which data file backend do you use: XML file, Sqlite file, SQL database (MySQL etc)?
Comment 2 Caleb Mattoon 2011-05-16 04:39:52 UTC
Thanks for the reply! The data file was stored as a gzipped xml file. I just tried switching to sqlite (SQLite 3.x), and closing/reopening the gnucash session. Creating the cash flow report is still slow, however.

Now, I just tried again on creating a report and still get fairly consistent behavior: when I first try creating a new cash flow report (from the 'Reports/Income and Expense' menu), it takes about 50 seconds each time (I overestimated in previous post, actually timed it this time). Then, I tried changing some account options. When I tried adding/removing accounts, the new report is generated almost immediately. If I change the start/end dates, it takes a bit longer depending on the date range...
Comment 3 Carsten Rinke 2013-04-29 17:46:01 UTC
Hi Caleb,

did you meanwhile upgrade to a later release? Do you still see this behaviour?
Comment 4 slowthinker9 2013-10-13 15:59:58 UTC
The generation of the cash flow report is very slow for me as well.
Version: 2.4.11 (r22268) on Windows
Store: XML, compressed; tried sqlite as well, still slow
I have about 1200 entries in my file.
Comment 5 Mike 2015-01-07 00:55:09 UTC
I have found a simple fix that greatly speeds up report creation.  Like Caleb, I also keep two cash flow report open in tabs for current and previous months.  I also found that the report will regenerate quickly (~5 sec), but take a long time to open initially (~45 sec).  One thing I noticed was that the long generation time corresponded to times that the progress bar was showing for the generation.  The progress bar does not show when regenerating a report after changing options.

I assumed that the issue might be related to updating the progress bar graphics.  To test this I changed the guile cash flow report (cash-flow.scm) to only update the progress bar every 100 records processed.  This greatly speeds up cash flow report creation, and keeping the reports open now has minimal impact on opening GnuCash.

I use the Mac OS X version of GnuCash, and have applied this fix to several 2.4.x versions and to 2.6.4.

The fix to cash-flow.scm was changing line 262 from:

		        (gnc:report-percent-done (* 85 (/ work-done splits-to-do)))

to:

		      (if (= (modulo work-done 100) 0)
		        (gnc:report-percent-done (* 85 (/ work-done splits-to-do)))
		           )

I assume that this same fix could be applied to other slow reports, although I have not taken the time to check.
Comment 6 Geert Janssens 2015-02-10 18:53:32 UTC
Thank you for the suggestion.

I have tried the change on linux as well. It doesn't speed
up nor slow down the generation of the cash flow report. Only
the progress bar updates are less frequent causing it to 'stutter'
slightly more.

However if this greatly improves the performance on OS X (and hopefully
on Windows) I am all for applying this patch.

I have committed this to maint, so it will appear in gnucash 2.6.6.
Comment 7 John Ralls 2017-09-24 22:48:17 UTC
Reassign version to 2.4.x so that individual 2.4 versions can be retired.
Comment 8 John Ralls 2018-06-29 22:57:47 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=649933. Please update any external references or bookmarks.