Thoughts on some stdlib modules

Fredrik Lundh fredrik at pythonware.com
Sun Apr 10 10:03:41 EDT 2005


Kay Schluehr wrote:

> > it's also GPL:ed, and the namespace support is totally broken.  there
> > are faster solutions out there with Python-compatible licenses.
>
> Interesting. Which implementation "out there" ( so not in the std-lib )
> that maps the whole XML into an internal structure and makes it easily
> accessible is currently faster?

here are three alternatives:

    ltree (http://codespeak.net/lxml/)
    libxml2 (http://xmlsoft.org/downloads.html)
    celementtree (http://effbot.org/zone/celementtree.htm)

(ltree is an alternative binding to libxml2).

for raw parsing performance (disk to memory), see:

    http://effbot.org/zone/celementtree.htm#benchmarks

as for access, celementtree builds a tree of Python objects, while
the others have to convert the internal structures to Python objects
as you access them.  if you need to access large parts of the tree,
celementtree can be a lot faster (the yum developers report a 2-3x
speedup, for example). on the other hand, libxml2/ltree supports a
lot more XML standards (XPath, XSLT, various validation models,
etc) which can come in handy in many cases.

</F>






More information about the Python-list mailing list