GnuCash
Contact   Instructions
Bug 798237 - Logging during XML file loading degrades performance significantly
Summary: Logging during XML file loading degrades performance significantly
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Backend - XML (show other bugs)
Version: 4.6
Hardware: PC Linux
: Normal normal
Target Milestone: ---
Assignee: core
QA Contact: core
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-12 14:09 EDT by Simon Arlott
Modified: 2021-09-14 18:27 EDT (History)
3 users (show)

See Also:


Attachments

Description Simon Arlott 2021-07-12 14:09:36 EDT
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.
Comment 1 John Ralls 2021-09-14 18:27:00 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.