String Cache

Derek Atkins derek at ihtfp.com
Sat Aug 11 15:53:42 EDT 2012


Hi,

On Sat, August 11, 2012 3:34 pm, John Ralls wrote:
> There's a feature called qof_util_string_cache which is based on GLib's
> GCache facility, deprecated in Glib-2.32. It's fairly trivial to rewrite
> to use GHashTable, but it occurs to me that it's a bit stupid to incur the
> overhead of caching string constants. It's not like they use a lot of
> memory.

Each string doesn't, but there's a lot of duplication in overhead strings
(think the KVP keys for known KVPs that are used in every transaction). 
If you have 1000 transactoins then you would have 1000x the memory for
these strings.  Sure, it may be a 20 character string, but why use 20KB
when you only need 20B?

GnuCash is already large enough in terms of memory usage.  My current
GnuCash core size is 3114996.  (Yes, that' 3G memory footprint!). 
Admittedly it's been up and running since May 12, and the resident size is
only 96680 (93M).

I admit it's still micro-optimization that was implemented a long time
ago, but I think some of the reasoning still exists.

> Comments?
>
> Regards,
> John Ralls

-derek

-- 
       Derek Atkins                 617-623-3745
       derek at ihtfp.com             www.ihtfp.com
       Computer and Internet Security Consultant



More information about the gnucash-devel mailing list