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.
My programs run over a host with Linux 2.6.18-53.1.13 and 2 CPUs.
Unless there's a lot of background activity on your system, having two
CPUs is not going to make much of a difference.
The programs do ten parsing and return the mean parsing time:
I get
-1,6 sec with Xerces-C
-0,7 sec with Xerces-J
Is it normal? Is Xerces-C really slowest beacause of its internal character
handling?
It's possible, and there may be many reasons for it. I don't think
anyone has focussed on performance testing for Xerces-C for quite some
time. Also, you may find that your application's processing of the data
from the XML file dominates the actually parsing time, so the difference
between Xerces-C and Xerces-J won't matter.
Dave