[jdom-interest] Performance SAX versus DOM
Alex Rosen
arosen at silverstream.com
Thu May 30 07:00:53 PDT 2002
DOMBuilder hasn't been deprecated - the methods that act on a file or stream
have been deprecated. These methods should be slower than using SAXBuilder,
because DOMBuilder first has to read the file and turn it into a DOM tree,
and then turn that DOM tree into a JDOM tree. SAXBuilder just reads the file
and turns it directly into a JDOM tree.
On the other hand, if you already have a DOM tree, then using DOMBuilder is
fine. Is that what you're doing here?
Alex
-----Original Message-----
From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org]On
Behalf Of Martial Doré
Sent: Thursday, May 30, 2002 7:16 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Performance SAX versus DOM
Hi,
In beta 8, DOMBuilder has been deprecated as its javadoc says :
"The class can be used to build from files, streams, etc but other builders
like SAXBuilder can perform the task faster because they don't create a DOM
tree first."
However, in our case, SAXBuilder is 2x (small files) to 4x (larger files)
slower.
| 170 files 2kb-4kb | 87 files 6kb-43kb
DOM Xerces 2.0.1 | 88.8 | 456.1
SAX Xerces 2.0.1 | 196.3 | 2280.7
SAX Piccolo 1.02 | 158.6 | 2111.7
The numbers are average/file in ms, on VisualAge VM, with non-validating
parsers.
Moreover, reading then all the nodes of the document for creating
our object structure is 25% faster if it has been built with DOMBuilder...
Is there something I missed in my configuration or is there specific
performance issues
with SAXBuilder ?
Thanks,
Martial
More information about the jdom-interest
mailing list