Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Xerces-C vs Xerces-J, Performance Issue...?

843834Dec 6 2005
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 3 2006
Added on Dec 6 2005
0 comments
171 views