The Artima Developer Community
Sponsored Link

Python Buzz Forum
Lies, Damned Lies and [Benchmarks]

2 replies on 1 page. Most recent reply: Jan 4, 2005 7:22 AM by Aaron Brady

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Aaron Brady

Posts: 576
Nickname: insommeuk
Registered: Aug, 2003

Aaron Brady is lead developer for Crestsource
Lies, Damned Lies and [Benchmarks] Posted: Jan 1, 2005 4:14 PM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Aaron Brady.
Original Post: Lies, Damned Lies and [Benchmarks]
Feed Title: insom.me.uk
Feed URL: http://feeds2.feedburner.com/insommeuk
Feed Description: Posts related to using Python. Some tricks and tips, observations, hacks, and the Brand New Things.
Latest Python Buzz Posts
Latest Python Buzz Posts by Aaron Brady
Latest Posts From insom.me.uk

Advertisement
My experience screen-scraping with HTML Tidy and 4DOM. And why pyRXP is a tiny-god.

Read: Lies, Damned Lies and [Benchmarks]


Marius Gedminas

Posts: 1
Nickname: mgedmin
Registered: Jan, 2005

Re: Lies, Damned Lies and [Benchmarks] Posted: Jan 1, 2005 6:38 PM
Reply to this message Reply
I wanted to know how libxml2 (www.xmlsoft.org) compares in this benchmark, so I adapted your benchmark script to use libxml2: http://mg.pov.lt/test-libxml.py

Benchmarks on my 666 MHz Thinkpad (measured by running time python test-foo.py > /dev/null three times and taking the lowest value):

4dom: 0m6.091s (variance: 0.004s)
minidom: 0m0.616s (variance: 0.011s)
libxml2: 0m0.232s (variance: 0.006s)
pyRXP: 0m0.107s (variance: 0.001s)


libxml2 is faster than minidom, but slower than pyRXP. libxml2 supports Unicode and XPath, however it is not very Pythonic and forces you to do a certain amount of manual memory management (wrappers can help here, e.g. [1] or [2]). Comparing test-r.py and test-libxml.py, I'd choose libxml2 -- readability of the source code (xpath!) beats the slight speed disadvantage.

[1] http://source.schooltool.org/viewcvs/trunk/schooltool/src/schooltool/rest/xmlparsing.py?rev=1730&view=markup

[2] http://codespeak.net/svn/lxml/trunk/

Aaron Brady

Posts: 576
Nickname: insommeuk
Registered: Aug, 2003

Re: Lies, Damned Lies and [Benchmarks] Posted: Jan 4, 2005 7:22 AM
Reply to this message Reply
Thanks for the post! I might consider libxml2 in the future, I've heard good things, but the manual memory management scared me off :)

I've done plenty of programming in languages without a GC, but when I'm in Python I don't think about free()ing objects. Will check out the wrappers, though.

Flat View: This topic has 2 replies on 1 page
Topic: Moving Jython Forward: PSF Grant! Previous Topic   Next Topic Topic: Atlas of the universe

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use