# REXML Comparisons

## Timing Comparison

This page contains information comparing REXML to other XML parsing technologies. Included are timing comparisons. Each benchmark was run for 5 seconds, which probably isn't enough to flatten out startup bumps and so on, but EXML in particular barfed at a 10 second benchmark when it ran out of memory.

The numbers under the column headers are the versions of the library being used. The version under the EXML column is the version of Java that the test was run under; I'm not aware of a way to get the EXML library version. The version of Ruby is ruby 1.6.6 (2001-12-26) [i586-linux-gnu] .

The test for hand-parsing and XPath are looking for the same elements in a large document (tutorial.xml). Therefore, if the XPath value is half of the hand-parsing value, then on average, XPath is half as fast (but much easier!) as hand parsing.

These values are in calls-per-second; higher is better. The numbers in parenthesis are multiples of the REXML score; more than one is faster than REXML, less than one is slower. N/A means 'Not Applicable', meaning the parser doesn't support that function. The scores are color coded; Java scores are not included in this, since it wouldn't be meaningful. In these tests, Java is (nearly) always faster than Ruby. The color coding is as follows:

slowest | middle | fastest | not available

function | REXML 2.2.1 | NQXML 1.1.1 | XMLParser | EXML (no JIT) 1.4.0 | EXML (JIT) 1.4.0
--- | --- | --- | --- | --- | ---
Parsing small document | 51.2 | 31.4 (0.61) | 105.8 (2.07)
Creating and adding new Element | 2695.8 | 6596.0 (2.45) | 3837.6 (1.42)
Creating a new document tree | 631.6 | 2244.4 (3.55) | 564.6 (0.89)
Writing document out to a string | 7.6 | 2.6 (0.34) | N/A
Hand-parsing children | 1353.4 | 2656.2 (1.96) | 10.4 (0.01)
XPath | 16.2 | N/A | N/A
Parsing large document | 1.4 | 0.6 (0.43) | 1.8 (1.29)
Stream parsing | 2.2 | 0.6 (0.27) | 35.8 (16.27)