System.err.println("XML vs. SOAP Marshaller Profiling Comparison");
// --- XML test
SOAPMarshaller marshaller =
new XMLMarshaller(new InvocationContext(Repository.getMetadata()),
Repository.getMetadata());
for (int i = 0; i < nWarmup; ++i)
{
marshaller.serialize(req, writer);
}
long lStartTime = System.currentTimeMillis();
for (int i = 0; i < nIterations; ++i)
{
counterArray[0] = 0;
marshaller.serialize(req, writer);
}
long lEndTime = System.currentTimeMillis();
long nSizeXML = counterArray[0];
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
marshaller = new SOAPMarshaller(new InvocationContext(Repository.getMetadata()));
for (int i = 0; i < nWarmup; ++i)
{
marshaller.serialize(req, writer);
}
lStartTime = System.currentTimeMillis();
for (int i = 0; i < nIterations; ++i)
{
counterArray[0] = 0;
marshaller.serialize(req, writer);
}
lEndTime = System.currentTimeMillis();
long nSizeSOAP = counterArray[0];
long nTotalTimeSOAP = lEndTime - lStartTime;