David Bertoni <[EMAIL PROTECTED]> wrote on 04/15/2008 02:09:24 PM: > Ryad Ben-El-Kezadri wrote: > > Dear Xerces Users, > > > > I found that the SAX2 API under Xerces-J is >2 times faster than the > > Xerces-C 's one. > > > > I wrote two strictly equivalent programs using the lastest API : > > -Xerces-C 2.8 (with gcc 4.1.2) > > -Xerces-J 2.9.1 (with java 1.5.0) > > > > The SAX handlers do nothing (empty characters & startElement functions). > > The two programs parse a 16Mbytes size file (size16.xml). > > Maybe once your program starts doing something with the parse events, > the differences between a Java implementation and a C++ implementation > of your code may start to make a difference in terms of performance.
Also consider that the Java JIT compiler may be doing more than it can (or would) in a real application. For example, the calls to the ContentHandler may be getting devirtualized and inlined in this sort of test. Once you start loading other implementations of ContentHandler into the VM the calls might become virtual (which would cost more). Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED]
