System.err.println("XML vs. SOAP Unmarshaller Profiling Comparison");
// --- XML test
SOAPUnmarshaller unmarshaller =
new XMLUnmarshaller(new InvocationContext(Repository.getMetadata()),
Repository.getMetadata());
for (int i = 0; i < nWarmup; ++i)
{
unmarshaller.deserialize(new StringReader(xmlOut.toString()));
}
long lStartTime = System.currentTimeMillis();
for (int i = 0; i < nIterations; ++i)
{
unmarshaller.deserialize(new StringReader(xmlOut.toString()));
}
long lEndTime = System.currentTimeMillis();
long nSizeXML = xmlOut.toString().length();
long nTotalTimeXML = lEndTime - lStartTime;
System.err.println("Run: " + nIterations + " iterations in: " + nTotalTimeXML/(double)1000 +
" sec");
System.err.println("XML Time: " + nTotalTimeXML/(double)nIterations + " ms");
System.err.println("XML Size: " + nSizeXML + " chars");
System.err.println("XML Unit: " + nTotalTimeXML/(double)nIterations/nSizeXML * 1000000 +
" ns/char");
//--- SOAP test
unmarshaller = new SOAPUnmarshaller(new InvocationContext(Repository.getMetadata()));
for (int i = 0; i < nWarmup; ++i)
{
unmarshaller.deserialize(new StringReader(soapOut.toString()));
}
lStartTime = System.currentTimeMillis();
for (int i = 0; i < nIterations; ++i)
{
unmarshaller.deserialize(new StringReader(soapOut.toString()));
}
lEndTime = System.currentTimeMillis();
long nSizeSOAP = soapOut.toString().length();
long nTotalTimeSOAP = lEndTime - lStartTime;