Memoization
Gary Benson <[email protected]> Thu, 8 Aug 2002 02:34:07 +0100
| Newsgroups | gmane.comp.gnome.lib.xml.bindings |
|---|---|
| Message-ID | <[email protected]> |
Hiya, I have an application which uses the Python bindings, and I've been looking at ways to speed it up. The profiler shows that about three quarters of the time is spent parsing XML files and there are _a lot_ of repeat parsings going on. Now, it occurred to me that I could speed it up tremendously if I could somehow cache the parsed xmlDocs, but it isn't possible at the Python level since a lot of the repeat parsings are files loaded in the XSLT stylesheets via document(). To be truly effective I'd have to cache them within libxml itself. Ideally, you'd call xmlParsedDocsCache(1) to enable the cache, such that the normal behaviour is unchanged. I'd appreciate some insight from those who know libxml best (so probably Daniel :)). Is what I'm talking about possible, and if it is where would be a nice place to implement it. Obviously I'd like to be able to call xmlParsedDocsCache() from Python code, but how do I make that happen with the automated generator stuff? Libxml is a big bugger and it's hard to know where to start :) Thanks in advance, Gary [ [email protected] ][ GnuPG 85A8F78B ][ http://inauspicious.org/ ]