[jdom-interest] Time for SAXBuilder.build()

Ken Rune Helland kenh at csc.no
Mon Oct 9 07:05:17 PDT 2000


On Mon, 9 Oct 2000 philip.nelson at omniresources.com wrote:

> 
> > Every XML file has to parse with JDOM. Now I have noticed that the
> > SAXBuilder.build() method needs a lot of time.
> > Consider the very simple XML-file
> > 
> > <Book/>
> > 
> > In my code there are the following lines:
> > 
> > SAXBuilder builder = new SAXBuilder(false);
> > long time1 = System.currentTimeMillis();
> > Document doc = builder.build(uri);
> > long time2 = System.currentTimeMillis();
> 
> Try running the same test multiple times in a loop instead run once and
> quit.  Most likely the time is spent loading the Xerces classes.

Seems likley for a mid sized (11k) document this redused the
time from ca 1400 ms to 140 ms on this 650 Mhz pentium. 

And from 911ms to 10ms for a very small document

> While I think the overhead of parsing is high, this is out of bounds...
> 
> > What can I do to reduce this warmup time?

Gretings 
KenR




More information about the jdom-interest mailing list