Xerces-C vs Xerces-J, Performance Issue...?
I have the same code in C++ vs Java using Xerces XML.
Both code chunks do the same (just parse a simple XML from a String), the C++ code is performed about 3 times faster than the Java.
What am I doing wrong here...?
C++:
====
XercesDOMParser* parser = new XercesDOMParser();
string *sIncommingXML = new string("<profiles><profile_request attr1=\"5\" request_id=\"44797\">value1</profile_request></profiles>");
while (true)
{
MemBufInputSource* memBufIS = new MemBufInputSource
(
(const XMLByte*)sIncommingXML->c_str()
, sIncommingXML->length()
, "test"
, false
);
parser->parse(*memBufIS);
globalCounter++;
delete(memBufIS);
parser->resetDocumentPool();
}
Java
====
String sXMLRequest = "<profiles><profile_request attr1=\"5\"
request_id=\"44797\">value1</profile_request></profiles>";
DOMParser xmlParser = new DOMParser();
while (true)
{
StringReader rdr = new StringReader(sXMLRequest);
InputSource input = new InputSource(rdr);
xmlParser.parse(input);
globalCounter++;
rdr.close();
rdr = null;
input = null;
}
Dror