From online.effbot.org - Fredrik Lundh: celementtree 0.8:
(updated 2005-01-12: added libxml2 benchmark) cElementTree 0.8 is a fast and memory-efficient implementation of the ElementTree API, for Python 2.1 and later. On typical documents, it's 15-20 times faster than the Python version of ElementTree, and uses 2-5 times less memory. Here are some benchmark figures, using a number of popular XML toolkits to parse a 3405k document-style XML file from disk: librarytimespace xml.dom.minidom (Python 2.1)6.3 s80 MB xml.dom.minidom (Python 2.4)1.4 s53 MB ElementTree 1.21.6 s14 MB ElementTree 1.2.1/1.31.1 s14 MB PyRXPU (C extension)0.22 s11 MB libxml2 (C extension)0.098 s16 MB cElementTree (C extension)0.058 s5.7 MB readlines (read as text)0.032 s5.0 MB [more benchmarks]I think I've mentioned this elsewhere on the blog, but I've been toying with the idea of moving my XML parsing code from my hand rolled SAX solution to Fredrik Lundh's intuitive and pythonic ElementTree. My only concern were with speed and memory usage. Lundh's release of cElementTree addresses these issues pretty definitively. There is also mention of a port of ElementTree that uses libXML. The python blogsphere is buzzing over ElementTree right now. Can we take from this activity that this may become a standard?
When I ported the Chartshare project from perl to python, the only thing that I truly missed was Mirod's fabulous XML::Twig. I never liked dealing either directly with SAX or baroque DOM. I look forward to working with something that is a bit more natural feeling in the form of ElementTree.
Now, I just need to finish this annoying dissertation proposal out of the way so that I can get back to the business of programming.
Comments