public void testPerformance() throws Exception {
final int COUNT = 100000;
ISOPackager p = new GenericPackager ("src/main/resources/packager/iso87binary.xml");
ISOMsg baseMsg = getMsg("ISO87");
System.out.println ("\n--- pack/unpack performance test ---\n");
Profiler prof = new Profiler();
TPS tps = new TPS(true);
for (int i=0; i<COUNT; i++) {
pack (baseMsg, p);
tps.tick();
}
prof.checkPoint ("PACK " + tps.toString());
byte[] buf = baseMsg.pack();
tps = new TPS(true);
for (int i=0; i<COUNT; i++) {
unpack (buf, p);
tps.tick();
}
prof.checkPoint ("UNPACK " + tps.toString());
tps = new TPS(true);
for (int i=0; i<COUNT; i++) {
pack (baseMsg, p);
unpack (buf, p);
tps.tick();
}
prof.checkPoint ("PACK/UNPACK " + tps.toString());
tps = new TPS(true);
for (int i=0; i<COUNT; i++) {
updatePackAndUnpack(baseMsg, p);
tps.tick();
}
prof.checkPoint ("UPDATE/PACK/UNPACK " + tps.toString());
prof.dump(System.out, "");
System.out.println ("");
}