Would like to convert provider_list to std::list

John Ralls jralls at ceridwen.us
Thu Nov 13 11:05:53 EST 2014

> On Nov 13, 2014, at 7:12 AM, Aaron Laws <dartme18 at gmail.com> wrote:
> On Thu, Nov 13, 2014 at 9:46 AM, Chenxiong Qi <qcxhome at gmail.com> wrote:
>> Hi all,
>> I would like to convert provider_list in qofsession.cpp to std::list.
>> Make a small change (step) to C++. What do you say? :)
> Is this your first forray into contributing to gnucash (C or C++)? I think
> the hope is that qofsession will become 'class QofSessionImpl' or something
> like that, but I don't know that part of the code yet. It is probably a
> useful exercise for yourself to go ahead and do what you propose even if
> you're not interested in going "whole-hog" yet. I wouldn't hold your breath
> that this would be accepted, though (I don't do the accepting, by the way),
> because a global std::list may not be seen as an improvement in itself ^_^ .
> You asked "What do you say?", and this is what I say. Do keep in mind that
> I don't make any decisions like this for GnuCash development :-)


Aaron's right: There's no benefit to that particular change other than removing a single GLib dependency out of hundreds. Most of QofSession, including the provider list, isn't really used. It was added when the authors of QOF thought that QOF might be useful outside of GnuCash and wrote it to be much more general than GnuCash needs. Very little of QofSession is likely to survive the rewrite.

If you want a good target for conversion from GList, look at QofCollection in qofid.cpp. This class is heavily used and bogs down badly with large datasets. Study its use-cases and design a re-implementation that is fast and scalable -- or if appropriate, multiple implementations for different use-cases. Profile the current code and try different implementations profiling each. Be sure to consider and test using a custom allocator.

John Ralls

More information about the gnucash-devel mailing list