SAX performance

J

Jon Smith

I am using the Xerces SAX parser, to parser a lot of document of different
sizes. The problem is it always seems to take a minimum of about a second no
matter how big the document. 1k documents parser on my machine in around
1100ms and a 2.7MB document in 1.7, why is this is there a way of making it
go faster?

Thanks

jon
 
C

Collin VanDyck

Jon said:
I am using the Xerces SAX parser, to parser a lot of document of different
sizes. The problem is it always seems to take a minimum of about a second no
matter how big the document. 1k documents parser on my machine in around
1100ms and a 2.7MB document in 1.7, why is this is there a way of making it
go faster?

Thanks

jon

Part of it might be the JAXP underlying initialization, depending on if
you are just running these parse routines once (i.e. if your application
simply starts, parses something, and then exits).

If this is the case, try to see what happens when you parse multiple
documents in succession using the same JVM instance. I'd imagine that
you would see a greater difference in parse overhead.

Also, if your documents use a DTD, and you are using a validating
parser, the parser will most likely fetch the DTD each time the document
is parsed. If this is happening over an internet connection (for
example, the XHTML DTDs are usually fetched remotely), then much of your
overhead could be related to the latency incurred simply by retrieving
the DTD each time the document is parsed.

You can get around the DTD by just removing it, or use a DTDHandler (I
believe) to return a local, cached copy of the DTD instead of fetching
it each time.

HTH
Collin




HTH
 
J

Jon Smith

Thanks for this, like you said it appears most of the time is in creating
the parser, create a cache of parsers an now performance is good.

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top