Xmlbench is a project mainly written in Ruby, it's free.
Some benchmarks for Ruby XML libraries
These benchmarks were written for the article "XML Parsing in Ruby" on the Engine Yard blog.
http://www.engineyard.com/blog/2009/xml-parsing-in-ruby/
To use them, first ensure you have the Hpricot and Nokogiri gems installed.
gem install nokogiri hpricot
Benchmarks are run with Rake. To run a benchmark, run one of the following:
Pass N=
To add more data files, edit the Rakefile and change the URLs
hash
at the top. Be aware that some of the benchmarks make assumptions
about the documents taking the form of an Atom document, so those
benchmarks may break or be invalid.
A benchmark is an object responds to a method named
#perform(xml_input)
. The input is an IO-like stream containing the
document to be parsed. A benchmark can also respond to a method named
#prepare(xml_stream)
. The prepare method is called once before the
benchmark measurement and can be used to setup any state whose
creation shouldn't be included in the measurements.
Each benchmark should be in its own file and have an overload for the Harness.parser factory method as follows:
class Harness
def self.parser
MyParser.new
end
end
If you're running benchmarks with JRuby, be aware of the following issues: