[jdom-interest] Using NanoXML and JDOM

Dennis Sosnoski dms at sosnoski.com
Mon Oct 1 15:42:24 PDT 2001

I rechecked my figures on the memory sizes for documents in the more recent (not yet
published) tests. For test documents in the 100-200KB range the default Xerces DOM with
unexpanded nodes comes in about 20% smaller than JDOM. If you turn off the deferred node
expansion option for Xerces the size is about the same as for JDOM. Xerces DOM also came
in at about the same speed as JDOM for these documents.

But, for one *small* (415 byte) test document I'd tossed into the mix JDOM comes in much
better than Xerces DOM on both memory usage and build speed. It looks like for small
documents JDOM does much better relative to Xerces DOM. I'll add a separate set of
documents to look at this for the next time I run the tests, probably around the end of
the month.

Given that memory size is only likely to be an issue for large documents the first
paragraph figures are probably the more relevant on this issue, though.

  - Dennis

Dennis Sosnoski wrote:

> Hi Paul,
> I'd be interested in seeing how you tested JDOM vs Xerces DOM. My own tests have
> shown the two about the same speed, but Xerces DOM with considerably less memory
> consumption per document. You can see some older results at
> http://www.sosnoski.com/opensrc/xmlbench/results.html; the newer results will be
> published soon, but don't show any substantial change in the JDOM vs DOM memory size
> comparison.
> Xerces parser is definitely slow, though. It looks especially bad on small documents,
> so I assume it has initialization issues.
>   - Dennis
> Paul Libbrecht wrote:
> > Actually, I'd highly recommend to get rid of Xerces as soon as you're no
> > more interested into its (probably powerful) flexibility...
> >
> > A candid benchmark happened to me as follows: to parse the same set of 40
> > files exposing DOM using Xerces takes the double of the time as parsing
> > the same files fire SAX-events to JDOM using Xerces which, in turn, takes
> > the double of the time to using Michael Kay of ICL's revisited AElfred
> > parser to fire SAX events.
> > Oh, and for the comparison, the JDOM docs loaded in RAM take the half of
> > the memory of the DOM-exposing objects of Xerces for the same collection
> > of files.
> >
> > So if you are interested only at the JDOM objects, do, do, do, change
> > parser.
> >
> > Michael Kay's revisited AElfred parser has a BSD license and, this is
> > probably why you're interested at it, is extremely small: 29 Kb compressed.
> > What's greatest, it holds in two source files !
> > More info from his Saxon page (the parser is included in it):
> >         http://users.iclway.co.uk/mhkay/saxon/
> >
> > Aside of not supporting DOM, I'd urge JDOM gurus to consider including it.
> > This would be even more friendly as he has made glue code to accept JDOM
> > documents as transformation source (which is, I believe, an optimal way).
> >
> > Paul
> >
> > On Mercredi, septembre 19, 2001, at 04:01  PM, Sebastien Pierre wrote:
> >
> > > Hi all,
> > >
> > > Is it possible to use another SAX parser than the ones that comes with
> > > JDOM?
> > > I was thinking about NanoXML.
> >
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

More information about the jdom-interest mailing list