I did the same test as you. Parsed a XML file (size ~5k) with DTD validation
and reuse grammar 1000 times with DOM and 1000 times with SAX and an Empty
Document handler. I made sure to load up the grammar before doing the
benchmark so the grammar build time is not in the results.
And my result is that SAX is faster. SAX took aprox 6000ms and DOM took
approx 8700ms. And those results are not suprising at all :o)
So the conclusion... If SAX is slower then DOM for your application, then
take a peek at what you are doing in your content handler or just swap API.

Regards
Erik Rydgren
Mandarinen systems AB
Sweden

-----Original Message-----
From: Nikko [mailto:[EMAIL PROTECTED]]
Sent: den 2 december 2002 17:36
To: mailing list xercesc
Subject: DOM faster than SAX ?


Hi,
I've made some measurements, comparing a SAX parsing time to the time needed
to build a DOM tree, with the same pinput xml. All that without File I/O
time.

 Results are quite surprising : DOM seems to be 2* faster than SAX.
I was wondering if this could be due to the string conversion to local page,
that is made always in SAX, but only on demand on DOM ?

Any comment appreciated,

thanks


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to