[jdom-interest] JDOM tree vs. DOM Tree...
Dennis Sosnoski
dms at sosnoski.com
Wed Mar 5 19:29:32 PST 2003
Bradley S. Huffman wrote:
>Brian Ales writes:
>
>>I'm wondering how the JDOM tree measures up against the standard DOM tree in
>>terms of both performance (speed coming out of the parser) but more important
>>ly memory size.
>>
>>
>Dennis Sosnoski wrote a article comparing the various models at
>
> www-106.ibm.com/developerworks/xml/library/x-injava
>
>but it's starting to get a bit dated (hmmm, 1yr dated?).
>
I don't think there's actually been any significant changes since then,
which is mainly why I haven't updated results. I did run some tests with
JDOM beta 8 with about the same results as reported for the older
version. I couldn't run a full set of tests on JDOM because of the build
memory issue (StringBuffer or whatever), though. Whenever JDOM beta 9
comes out I'll try again.
>But if you're looking to process large documents, none of the in-memory models
>will work very well and you should look at using SAX or a Pull Parser if
>they can fit your needs.
>
>Brad
>
If you need to be work with large documents you've basically got the
choices of on-the-fly processing (SAX or pull parsing), piece-meal
processing with a document model (dom4j has had this for a while, and I
think it's in JDOM contrib, too, right?), or data binding. In a recent
article on devWorks I show time and memory comparisons for various data
binding approaches, with dom4j included for comparison purposes:
http://www-106.ibm.com/developerworks/library/x-databdopt2/ Data binding
can be *much* more efficient than document models if all you want is to
work with documents as data (rather than as marked-up text). This is
especially true if many of your values can be converted to Java
primitive types.
I'm releasing a second demo/alpha version of the JiBX framework
(http://www.jibx.org) mentioned in the article later tonight. It's
actually usable for many types of applications in this alpha form, but
I'll have a beta version out within two weeks that'll be much more
comprehensively tested. If data binding sounds like it might suit your
needs you should check this out. JAXB is also out now, and either that
or Castor might be good choices if you're working from Schema
descriptions of your documents. I cover this in the devWorks articles,
so see the link above if you want details.
- Dennis
More information about the jdom-interest
mailing list