GNOME Bugzilla – Bug 335559
xmlXPathRegisterAllFunctions and xmlHashCreate are slow
Last modified: 2021-07-05 13:26:40 UTC
According to callgrind, the above functions slow down the creation of an XPath context (xmlXPathNewContext) considerably (allmost 100% of the time spent in xmlXPathNewContext is eaten by the two, about 50% each). Is it really necessary to call them? Would it be possible to use pre-built hash tables with all default XPath functions registered and only copy them in xmlXPathNewContext? That should really, really speed up context creation.
Reuse contexts ! They can be used without limits as long as it on the same document. BTW the current version is 2.6.23, 2.4.23 is way too old. Daniel
Sorry, my fault, I meant to file it on 2.6.23 (which is actually missing from the list). Changed it now to 2.6.22 (the highest available). I can (and do) reuse contexts in some cases (where the document stays the same) but have to build new ones in other cases, e.g. when I want to use a compiled XPath expression on different documents. There, I *could* potentially store a reference to the XPath context with each document, but that would rather be a work-around that somewhat complicates things. So, what about my suggestion of reusing hash tables internally? Would that make sense? Stefan
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME/libxml2/-/issues/ Thank you for your understanding and your help.