Personal tools
You are here: Home Developers Corner Run time behaviour XML and Python XML handlers
Document Actions

XML and Python XML handlers

by Rasmus Fogh last modified 2007-05-09 07:34

Python announces that the elementTree XML I/O modules, including the cElementTree  speed-optimised C version will be part of Python 2.5. Meanwhile they are available as such from http://effbot.org/zone/element-index.htm.

elementTree is available as a pure Python version (based on the xml.sax module that is a Python built-in). The cElementTree obviously requires compilation.

A very rough estimate on one of our NmrConstraints.xml data file gives the following benchmarks:

File NmrConstraints.xml, 20M size, 422566 XML nodes:

CCPN handcoded parser (approx):                 7.       s
elementTree.XMLTreeBuilder:                     87.124 s
elementTree.SimpleXMLTreeBuilder:         137.958 s
elementTree.cElementTree (estimate)          4.5     s

The pure Python elementTree seems OK for model data. It has the advantage that it supports xInclude, which would let us divide the model in several files and still stay within the XML standards.

For parsing actual XML data, the Python version is clearly too slow, while the C version would be good. If we do not want to support more compiled C code, we should wait till PYthon 2.5 to change over our XML handling.





As of May 2007, Model I/O is based on the Python version of ElementTree.

Data I/O currently uses the Python version as well, but should be shifted over to use the built-in version if available


Powered by Plone, the Open Source Content Management System

This site conforms to the following standards: