[jdom-interest] Performance tests
dms at sosnoski.com
Mon May 7 01:22:04 PDT 2001
Just a note that I've got a performance test program running. I'll add the
information and full distribution to my site Monday night, but in the meantime
here's a summary of the results for working with a sampling of medium-sized
(100-200K) XML files:
Document building speed -
Best results are from Xerces DOM with deferred node expansion (Xerces deferred).
This is more than made up for if you actually use most of the document (as
opposed to reading it in and looking at only a small portion), though.
Next best Crimson DOM, dom4j, and Xerces DOM with deferred node expansion turned
off (Xerces base) are all close on speed, JDOM and Electric XML the slowest of
the representations tested. The difference is roughly 50% added time from
Crimson DOM to JDOM.
Document memory requirement -
Best results again for Xerces deferred, but going through the document expands
the nodes to largest size of all.
Next best is Crimson DOM, then Xerces base, followed by Electric XML, JDOM and
dom4j. The difference is about 25-40% added space in going from Crimson DOM to
Walking the document nodes -
Best by far is Xerces base, followed by Electric XML and Crimson DOM, then
dom4j. JDOM is nearly as bad as Xerces deferred at this (with Xerces expanding
all the nodes as it goes). Xerces base is 10-20 times the performance of
JDOM/Xerces deferred in this test.
Output to text -
Crimson DOM, Xerces base and deferred, Electric XML all fairly close on this,
JDOM took about 50% more time, but dom4j about 100-150% more time than Crimson.
Those that implemented this (Xerces, JDOM, and Electric XML - dom4j appeared
broken and Crimson didn't support it) all did pretty badly. With the existing
implementations you're much better off just outputting text and parsing it back
in, this will be about twice as fast and the data will be half the size.
I used three different XML files representing different types of XML (heavy
attributes vs no attributes, shallow tree vs deeper tree). The results varied
depending on the type of XML, and I'll try to qualify this when I put something
up on the site. The code will also be available for review and experimentation.
It's really rough trying to get consistent results for timing with a Hot Spot
JVM, and some of the timing runs are dramatically better than others, but the
above figures should be loosely representative for the most recent released
versions of the products (Beta 6, in JDOM's case).
More information about the jdom-interest