1.3 Beta 4 performance

JBufferHandlerPcapHeaderJBuffer
Read 15 files, with 7341 packets, for 2203511 bytes
JBuffer
Effective test memory usage = Overall process memory - base
public void nextPacket(PcapHeader header, JBuffer buffer, Object unused) {
  PcapPacket pkt = new PcapPacket(header, buffer);
  pkt.scan(Ethernet.ID);
}
#1  10:50:45: tot=1.55Mp Kpps=98.05(10198.51ns) rate=224.50Mbps rm=23.26Mb 
#2  10:51:00: tot=3.09Mp Kpps=102.88(9719.71ns) rate=235.56Mbps rm=23.50Mb 
#3  10:51:15: tot=4.63Mp Kpps=103.20(9689.87ns) rate=236.29Mbps rm=23.50Mb 
PcapPacket
final PcapPacket packet = new PcapPacket(JMemory.POINTER);
public void nextPacket(PcapHeader header, JBuffer buffer, Object unused) {
  packet.transferHeaderAndDataFrom(header, buffer);
  pkt.scan(Ethernet.ID);
}
#1  10:55:48: tot=1.55Mp Kpps=95.23(10500.65ns) rate=218.04Mbps rm=23.19Mb 
#2  10:56:04: tot=3.09Mp Kpps=100.27(9973.34ns) rate=229.57Mbps rm=23.34Mb 
#3  10:56:19: tot=4.63Mp Kpps=100.37(9963.61ns) rate=229.80Mbps rm=23.30Mb 
public void nextPacket(PcapHeader header, JBuffer buffer, Object unused) {
  PcapPacket packet = new PcapPacket(header, buffer);
}
#1  11:03:33: tot=22.03Mp Kpps=618.40(1617.09ns) rate=1415.89Mbps rm=22.97Mb 
#2  11:04:08: tot=44.05Mp Kpps=628.38(1591.38ns) rate=1438.76Mbps rm=7.31Mb 
#3  11:04:43: tot=66.08Mp Kpps=629.79(1587.84ns) rate=1441.97Mbps rm=9.38Mb 
PcapPacket
final PcapPacket packet = new PcapPacket(JMemory.POINTER);
public void nextPacket(PcapHeader header, JBuffer buffer, Object unused) {
  packet.transferHeaderAndDataFrom(header, buffer);
  packet.scan(Ethernet.ID);
  new Object(){}; // Needed to force JVM minor GC collection
}
#1  10:55:48: tot=1.55Mp Kpps=95.23(10500.65ns) rate=218.04Mbps rm=23.19Mb 
#2  10:56:04: tot=3.09Mp Kpps=100.27(9973.34ns) rate=229.57Mbps rm=23.34Mb 
#3  10:56:19: tot=4.63Mp Kpps=100.37(9963.61ns) rate=229.80Mbps rm=23.30Mb 
PcapPacket
final PcapPacket packet = new PcapPacket(JMemory.POINTER);
public void nextPacket(PcapHeader header, JBuffer buffer, Object unused) {
  packet.transferHeaderAndDataFrom(header, buffer);
}
#1  11:14:36: tot=9.79Mp Kpps=778.57(1284.40ns) rate=1782.63Mbps rm=563.47Mb 
#2  11:14:48: tot=19.58Mp Kpps=826.20(1210.36ns) rate=1891.69Mbps rm=780.61Mb 
#3  11:15:00: tot=29.36Mp Kpps=816.48(1224.76ns) rate=1869.43Mbps rm=992.92Mb 
#4  11:15:12: tot=39.15Mp Kpps=808.12(1237.44ns) rate=1850.29Mbps rm=113.10Mb 
#5  11:15:24: tot=48.94Mp Kpps=828.44(1207.09ns) rate=1896.81Mbps rm=325.10Mb 
#6  11:15:36: tot=58.72Mp Kpps=819.70(1219.96ns) rate=1876.79Mbps rm=582.11Mb 
#7  11:15:48: tot=68.51Mp Kpps=824.05(1213.52ns) rate=1886.75Mbps rm=794.59Mb 
#8  11:16:00: tot=78.29Mp Kpps=820.80(1218.33ns) rate=1879.31Mbps rm=1006.82Mb 
#9  11:16:12: tot=88.08Mp Kpps=803.94(1243.87ns) rate=1840.71Mbps rm=127.41Mb 
PcapPacket
final PcapPacket packet = new PcapPacket(JMemory.POINTER);
public void nextPacket(PcapHeader header, JBuffer buffer, Object unused) {
  packet.peerAndScan(Ethernet.ID, header, buffer);
}
#1  11:31:13: tot=1.33Mp Kpps=107.78(9278.10ns) rate=0.00Mbps rm=22.82Mb 
#2  11:31:25: tot=2.65Mp Kpps=114.90(8703.02ns) rate=0.00Mbps rm=22.95Mb 
#3  11:31:36: tot=3.97Mp Kpps=114.90(8703.02ns) rate=0.00Mbps rm=22.96Mb 
PcapPacket
final PcapPacket packet = new PcapPacket(JMemory.POINTER);
public void nextPacket(PcapHeader header, JBuffer buffer, Object unused) {
  packet.peer(header, buffer);
}
#1  11:27:16: tot=44.16Mp Kpps=3360.74(297.55ns) rate=0.00Mbps rm=22.27Mb 
#2  11:27:28: tot=88.32Mp Kpps=3506.12(285.22ns) rate=0.00Mbps rm=22.38Mb 
#3  11:27:41: tot=132.48Mp Kpps=3515.05(284.49ns) rate=0.00Mbps rm=22.40Mb 
PcapPacketTcpScanner
final PcapPacket packet = new PcapPacket(JMemory.POINTER);
final ByteBuffer arrayBuffer = ByteBuffer.allocate(8 * 1024); // Array based
final Tcp tcp = new Tcp();
JPacket.setDefaultScanner(new TcpScanner());

public void nextPacket(PcapHeader header, JBuffer buffer, Object unused) {
  packet.peerAndScan(Ethernet.ID, header, buffer); // Uses TcpScanner
  if (packet.hasHeader(tcp)) {
    final int offset = tcp.getPayloadOffset();
    final int length = tcp.getPayloadLength();
    buffer.transferTo(arrayBuffer , offset, length); // Copy to java byte[]
    arrayBuffer.clear(); // Reset position back to 0
  }
}
#1  11:40:14: tot=44.16Mp Kpps=1272.61(785.79ns) rate=667.48Mbps rm=22.27Mb 
#2  11:40:48: tot=88.32Mp Kpps=1290.40(774.95ns) rate=676.81Mbps rm=3.54Mb 
#3  11:41:23: tot=132.48Mp Kpps=1291.61(774.23ns) rate=677.44Mbps rm=6.87Mb 
PcapPacketTcpScanner
final PcapPacket packet = new PcapPacket(JMemory.POINTER);
final ByteBuffer arrayBuffer = ByteBuffer.allocate(8 * 1024); // Array based
final Tcp tcp = new Tcp();
JPacket.setDefaultScanner(new TcpScanner());

public void nextPacket(PcapHeader header, JBuffer buffer, Object unused) {
  packet.peerAndScan(Ethernet.ID, header, buffer); // Uses TcpScanner

  buffer.transferTo(arrayBuffer , 0, buffer.size()); // Copy to java byte[]
  arrayBuffer.clear(); // Reset position back to 0
}
#1  11:56:47: tot=44.16Mp Kpps=1044.13(957.74ns) rate=2263.19Mbps rm=22.30Mb 
#2  11:57:29: tot=88.32Mp Kpps=1053.67(949.06ns) rate=2283.87Mbps rm=3.59Mb 
#3  11:58:11: tot=132.48Mp Kpps=1054.10(948.68ns) rate=2284.80Mbps rm=6.92Mb