gnucash maint: Optimize calls to get_path_kvp so that std::strings are not always created and deleted immediately.

Christian Stimming cstim at code.gnucash.org
Sun Jun 17 16:52:50 EDT 2018


Updated	 via  https://github.com/Gnucash/gnucash/commit/1e3a4450 (commit)
	from  https://github.com/Gnucash/gnucash/commit/4aaa18ea (commit)



commit 1e3a4450072dc5c2f2fec75b6c506e4fd62bdc43
Author: Christian Stimming <christian at cstimming.de>
Date:   Sun Jun 17 22:23:16 2018 +0200

    Optimize calls to get_path_kvp so that std::strings are not always created and deleted immediately.
    
    Turns out that the on-the-fly conversion from const char* (the KVP_OPTION_PATH
    constants) to std::string with their immediate deletion afterwards is
    a quite costly operation. Avoiding this is surprisingly easy: Just keep
    local std::string objects at hand, and they don't have to be created
    and deleted anymore.
    
    The more optimized solution might be to turn the std::vector<std::string>
    into a std::vector<GQuark>, but this commit at least improves the picture for now.



Summary of changes:
 libgnucash/engine/qofbook.cpp | 68 +++++++++++++++++++++++--------------------
 1 file changed, 37 insertions(+), 31 deletions(-)



More information about the gnucash-patches mailing list