File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes DOM4j , JDOM, DOM and Sax Performance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "DOM4j , JDOM, DOM and Sax Performance" Watch "DOM4j , JDOM, DOM and Sax Performance" New topic

DOM4j , JDOM, DOM and Sax Performance

ravisha andar
Ranch Hand

Joined: Feb 25, 2011
Posts: 55
Hi All,

I have read about all the 4 technologies , but still have confusions over which one gives a better performance.

Can anybody help me in understanding which of these is preferred for performance.

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
Since all parsers that I am familiar with actually use a SAX parser as a starting point, about the only thing we can say is that SAX is always fastest since the others build on top of SAX.

That is such a superficial answer that it really feels sort of silly to write it down.

In reality, a skilled programmer would select an approach by considering the entire problem since parsing is only part of using XML.

There have been oh-so-many discussions of this type in this forum, browse around in the old threads.

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

A skilled programmer would also not evaluate products based on a vague term like "performance". Instead he or she would consider memory usage, speed of processing, and probably other "performance" factors.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
These are Application Programming Interfaces (API), they are not "parsers." They help developers develop applications that interact with a parser. To understand them clearly is to recognize that the "parsing" and the "processing" that you code is not the same. That said, the performance or speed of any application written with any of these API will depend mostly on how well the application was written. If it is written in a poor way with memory hogging data structures and such, it might be much slower than a different application written with the same API but with a more efficient design.

Aside, if you can write an application using the Simple API for XML (SAX), this will most likely be the fastest. But, depending upon the actual requirements it may take longer to write or may exceed the programmer's skill level, i.e. writing SAX-based code takes advanced knowledge of XML and Java.
I agree. Here's the link:
subject: DOM4j , JDOM, DOM and Sax Performance
It's not a secret anymore!