[xml-sig] _get_elements_by_tagName_helper taking resources

Stefan Behnel stefan_ml at behnel.de
Wed Jun 13 20:35:37 CEST 2012

Joe Borġ, 13.06.2012 19:39:
> I'm running a script with 2.7 that deals with some heavy XML files.  I'm
> trying to speed it up best I can; using cProfile I've seen what's taking
> all the time.  It's the function _get_elements_by_tagName_helper.  Can
> anyone tell me where this is called and if I can improve its runtime speed?

I assume you are using minidom? My (biased) advice would be to switch to
lxml. It's substantially faster than mindom in basically all regards.
Alternative, if that suits your needs, use the xml.etree.cElementTree
package in the stdlib, which is also substantially faster but less capable.


More information about the xml-sig mailing list