On 29.04.2011, at 16:34, Pierre-Alain Dorange wrote: > I'm making so tests and debug, and i'll post the final code tomorrow. > > The actual code : > https://github.com/padorange/osm-xml-tests
Thanks for sharing your code! iterparse is slower in you case, because you're using the Python version of ElementTree and not cElementTree. You need to change the import: from xml.etree import cElementTree as ElementTree # fast xml parser module [/tmp/osm-xml-tests]% python xml_test.py -f /Users/olt/dev/osm_data/hamburg.osm ------------------------------------------------- ElementTree (iterparse) unknown element bound > 524316 nodes parsed, 26 match > element tree parsing : 10.6 seconds ------------------------------------------------- xml.sax Don't know element osm Don't know element bound > 524316 nodes parsed, 26 match > element tree parsing : 15.4 seconds ------------------------------------------------- [/tmp/osm-xml-tests]% ll /Users/olt/dev/osm_data/hamburg.osm -rw-r--r-- 1 olt staff 127869154 Jan 19 2010 /Users/olt/dev/osm_data/hamburg.osm BTW: You can safe a few lines of code if you handle everything in the 'end' clause, see my code example. Regards, Oliver -- Oliver Tonnhofer | Omniscale GmbH & Co KG | http://omniscale.de http://mapproxy.org | https://bitbucket.org/olt | @oltonn _______________________________________________ dev mailing list [email protected] http://lists.openstreetmap.org/listinfo/dev

