[jdom-interest] JDOM2 performance

Rolf Lear jdom at tuis.net
Thu Mar 1 16:36:39 PST 2012


Hi all.

As an exercise in a few things, I have run a number of comparative 
performance tests, comparing JDOM2 (Beta 2) against JDOM 1.1.3.

I put together a performance 'test harness' to track the changes in the 
performance metrics for JDOM2, and I have taken that harness, stripped 
out those things which are not available in JDOM 1.1.3, and then run the 
system on both code bases. I ran the tests in Java5, Java6, and Java7.

I took the performance harness cloned it for JDOM 1.1.3, and 
'backported' it. I did the same types of changes to the JDOM2 harness to 
make them equivalent. I compiled both harnesses with Java6 using a Java5 
class target. For the JDOM 1.1.3 test I linked in the JDOM 1.1.3 jar 
(which is compiled with Java5, and targets Java 1.2). For the JDOM2 test 
I linked in the Beta2 code (compiled with Java6 targetting Java 5).

I then took those code bases, and ran them using the Java5, 6, and 7 JRE's.

YOu can see the results here: 
http://hunterhacker.github.com/jdom/jdom2/performanceJDKBeta2.html

 From that page you can see a number of interesting things: firstly, the 
XPath expression '//.' is much, much, much faster than '//node()' (in 
jaxen).

The second item is the jump in memory footprint from Java5 to Java6

You can see that most JDOM2 operations are slightly slower than JDOM 
1.1.3, except XPath processing which is much, much faster.

At face value it would seem the slower performance is all related to a 
slower JDOM class initialization.... I will look in to that.

I figured the results were interesting, though, and there may be some 
benefit for others.

Rolf


More information about the jdom-interest mailing list