[jdom-interest] Performance SAX versus DOM

=?windows-1256?Q?Martial_Dor=E9?= martial.dore at laposte.net
Thu May 30 08:57:05 PDT 2002


No, I parse directly from a file (without having a pre-built DOM tree).
And what I see is that using the deprecated method DOMBuilder.build(File)
is significantly faster than SAXBuilder.build(File). 

Intuitively I agree with you that it *should* be the opposite - But is this
"theoritical" statement confirmed by the practice or benchmarks ?

> DOM Xerces 2.0.1     |  88.8              |        456.1
for: new DOMBuilder(false).build(this.file);

> SAX Xerces 2.0.1     | 196.3              |       2280.7
for: new SAXBuilder("org.apache.xerces.parsers.SAXParser", false).build(this.file);

> SAX Piccolo 1.02     | 158.6              |       2111.7
for: new SAXBuilder("com.bluecast.xml.Piccolo", false).build(this.file);


----- Original Message ----- 
From: "Alex Rosen" <arosen at silverstream.com>
To: "'Martial Doré'" <martial.dore at laposte.net>; <jdom-interest at jdom.org>
Sent: Thursday, May 30, 2002 16:00
Subject: RE: [jdom-interest] Performance SAX versus DOM


> 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
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20020530/dbed9855/attachment.htm


More information about the jdom-interest mailing list