[jdom-interest] Re: New realease, Text class... Arghh

Dennis Sosnoski dms at sosnoski.com
Wed Jan 9 16:21:33 PST 2002


Hi Brad,

Bradley S. Huffman wrote:

>You don't even need a Iterator.  Adding methods attributeCount(), nodeCount(),
>getAttribute( int), and getContent( int) provides the best performance by
>giving direct access to the backing list without without sacrificing
>well-formness.
>
I'm glad to see that JDOM is adding these methods, and I'll certainly 
make use of them in my testing if they're present in the next release. 
I've commented (in an article that IBM developerWorks has been sitting 
on for 3+ months) that JDOM probably needs some API changes to match the 
performance of some of the alternatives. Making the changes now rather 
than after a 1.0 release will definitely save everyone a lot of trouble.

>Don't believe everything you read, those test have a problem because he used
>a Iterator (there's that nasty beast again) to walk a Element's content
>instead of a for loop with a int, i.e. 5000 elements => 5000 Iterator creations.
>Changing BenchJDOM to use a for loop gave a performance increase of 10-30%.
>Changing Element and using the 4 methods above cut the time by 2/3.
>
I'm not sure it's entirely fair to say "those test have a problem", 
considering that I used what appeared to be the best methods available 
in the released version of the code. ;-) If the tests and related 
discussions on this list have helped isolate some of the performance 
problems with JDOM I'm glad to hear it, though.

  - Dennis




More information about the jdom-interest mailing list