Pieter van der Spek wrote:
      //Parse an XML document
      System.out.println("XMLReader:");
      System.out.println("Start: "+System.currentTimeMillis());
      parser.parse(instance);
      System.out.println("End: "+System.currentTimeMillis());
      System.out.println("-------");
      System.out.println("SAXParser:");
      System.out.println("Start: "+System.currentTimeMillis());
      parser2.parse(instance);
      System.out.println("End: "+System.currentTimeMillis());
>
> [...]

This tells me that the SAXParser takes 1339 milliseconds to complete while the XMLReader takes 4743 milliseconds to complete! What causes this difference. I expected both implementations to be approximately as fast.

And what happens when you run the same thing with the SAXParser first and the XMLReader second? Then try running a test parse *before* timing any parsing runs.

I'm guessing that your performance difference is due to Java
loading the parser classes the first time you parse. After that,
the classes are loaded and it's much faster.

--
Andy Clark * [EMAIL PROTECTED]

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



Reply via email to