Martijn Faassen wrote:
Stefan Behnel wrote: [snip]
So, as usual, feel free to test it and find new benchmark cases for it.
I'd be interesting to see how lxml compares to (c)ElementTree in benchmarks like this.
That's an easy one! :) Install them, do a checkout of the trunk and run make python bench.py -i -a (-i == in place, -a == use ElementTree and cElementTree if available) It will take a while - and in the end you will not be very impressed. One of the results of the benchmarks is that ElementTree beats lxml sometimes and that cElementTree beats lxml in most cases. The problems are: a) lxml has to deal with all sorts of backpointers and recursive clean ups in the libxml2 structure, which (c)ElementTree doesn't. b) I had to write the tests in a way that prevents lxml and ElementTree from benefitting from their different semantics (e.g. the implicit removal of lxml elements when copying) So, it's somewhat tricky to come up with comparable benchmarks - and if you find one, it's most likely one where ElementTree wins by default... Still, it's interesting to see the comparison. It tells you where lxml has its weaknesses. I've been putting some effort into removing or lifting some during the last two days, so it's a bit better now. But the relation above still holds. Stefan