fastxml progress


My little pet xml parser interface is coming along well. I’m starting to implement all the little detail bits of the Hpricot api. As well as can be done using libxml that is. If anyone wants to test it out or help out, the code is available from svn://hasno.info/fastxml. I’ve also gone ahead and created a trac instance. Now for some random stats:

(in /Users/segfault/Devel/fastxml)
ruby ./benchmarks/unicode.rb
                     user     system      total        real
fastxml.new      0.040000   0.000000   0.040000 (  0.048961)
fastxml.to_s     0.020000   0.010000   0.030000 (  0.021063)
fastxml.search   0.000000   0.000000   0.000000 (  0.002023)

hpricot.new 0.700000 0.030000 0.730000 ( 0.753549) hpricot.to_s 0.140000 0.010000 0.150000 ( 0.154857) hpricot.search 0.280000 0.000000 0.280000 ( 0.294201)

libxml.new 0.040000 0.000000 0.040000 ( 0.038258) libxml.to_s 0.010000 0.010000 0.020000 ( 0.024945) libxml.search 0.010000 0.000000 0.010000 ( 0.002113)

REXML.new 1.390000 0.030000 1.420000 ( 1.452444) REXML.to_s 0.440000 0.010000 0.450000 ( 0.464809) REXML.xpath 103.720000 0.500000 104.220000 (107.125149)

xpath expression: //p fastxml nodes: 10577 libxml nodes: 10577 hpricot nodes: 10577 REXML nodes: 10577

The unicode benchmark just run’s (new,to_s and an xpath query) on a well formed xml file (~900k). It’s apparent that everything is faster than rexml. I wonder if anyone’s game to add a REXML wrapper onto one of these libraries in order to speed up existing apps…