Any tips to improve performance?

Derek Atkins warlord at MIT.EDU
Tue Dec 29 10:42:05 EST 2009


Phil Longstaff <plongstaff at> writes:

> Many of the reports work by querying the engine for a set of splits matching a
> specific filter, then looping and adding the values (all in scheme).  Once the
> database backend is released in 2.4, this can be changed to a single SQL
> query.
> Some preparation for this could begin by adding an appropriate API to the
> engine (Account?) which takes a QofQuery for splits and returns the sum of the
> splits.  This at least creates the abstraction needed by the scheme code which
> can be replaced.

Note that in general the scheme functions are not returning a single
gnc_numeric total, but rather a list of <gnc_commodity,gnc_numeric>
tuples that sum up the amounts in each commodity.  Also note that
different reports are going to want to perform different types of
currency conversions based on different requirements.  For example, for
Income and Expense accounts you probably want to compute an exchange
rate based on the date of the transaction instead of the date of the
report, whereas Asset and Liabilities most likely want to compute
exchange rates based on the report date.

But yes, implementing some of this in C could possibly help improve

I'm not sure a SQL statement would work, because it sounds like 2.4 will
still default to XML, so the reports cannot (and should not) depend on
the use of SQL in the backend.

> Phil

       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL:    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available

More information about the gnucash-devel mailing list