There are a few problems here that together make the load process from XML much slower than it should be (compared to v2.6): 1. Debug logging in libgnucash/backend/xml/sixtp-dom-parsers.cpp dom_tree_to_text() 2. Debug logging in libgnucash/backend/xml/sixtp.cpp sixtp_sax_end_handler() 3. The extremely high overhead of libgnucash/engine/qoflog.cpp split_domain() called by qof_log_check() The performance of split_domain() could be improved: <@jralls> Simon, we might be able to get rid of the std::string construction in qof_log_check by changing split_domain to take a std::stringview instead of std::string. There is a default log level in qof_log_check() but I think there should be a minimum output log level check too so that output can be skipped quickly when debug logging isn't being used without needing to check how individual modules are configured.
qof_log_check turned out not to be the problem: It was used only for the ENTER and LEAVE macros and there were dozens of direct calls to g_message and g_debug that bypassed it anyway. GLog's log-level screening turns out to be quite slow. I've fixed all of that and implemented the two suggestions here as well for a 33% speedup in XML load time.