https://github.com/Gnucash/gnucash/commit/3a0ec89c
John Ralls
jralls at ceridwen.us
Thu Nov 5 00:19:04 EST 2015
>
> commit 3a0ec89c06c79db3489f760ab248d0240638732a
> Author: Mike Alexander <mta at umich.edu>
> Date: Mon Nov 2 21:16:09 2015 -0500
>
> Optimize pricedb so it works better with really big price lists.
>
> Opening my accounts file took over 10 minutes before this change, most of
> it spent populating the account balances in account tree, and most of that
> spent in g_sort_list. Expanding or collapsing subtrees in the account tree
> also took several seconds. This change reduces the use of g_sort_list and
> reduces the length of lists sorted when it is used. Opening the file is
> now only a few seconds slower than before the PriceDB changes.
Mike,
Wow, you must have a really big pricedb or maybe an old Mac. I’d done a first pass on this, replacing the GNCPriceList (with its sorted insert) with a plain GList and sorting at the end. I’ve got about 30K pricedb entries, and I never had the patience to let it finish — the longest I let it go was about 30 minutes. After replacing the GNCPriceList with a plain GList and sorting once at the end it loaded in a few seconds… and that turned into 10 minutes for you.
The comment at line 1497 is a bit misleading: It’s not the currency hash table that tells us they’re sorted, it’s that the currency hash table returns a GNCPriceList and we know *that* is sorted.
It looks like price_list_scan_any_currency has taken on a lot of the filtering requirements to minimize the returned list size. I think a comment at the top explaining what it does and how it does it would be helpful going forward.
Regards,
John Ralls
More information about the gnucash-devel
mailing list