C S Shyam Sundar's Weblog

DOM XML parsing in Ruby using libxml is really 300x faster than REXML

Posted by: Shyam Sundar on: August 17, 2008

Its true!

I tried parsing a 15MB, proper XML file with nearly 20 sub nodes for a parent node.

Being newbie to Ruby, I came across the default option of REXML. I instrumented the code using the Ruby benchmark API.

A Single simple XPath query for one node to traverse thro’ the entire XML file using REXML takes 2043 seconds.

The same using LibXML takes 2 seconds.,

This shows the power of a native C library and a wrapper!

Tags: , , , ,

Leave a Reply

You must be logged in to post a comment.