### Question:
FixSaxParser implements BytesSaxParser { @Override public void parse(Bytes bytes) { long limit = bytes.readLimit(), limit2 = limit; while (limit2 > bytes.readPosition() && bytes.readByte(limit2 - 1) != FIELD_TERMINATOR) limit2--; bytes.readLimit(limit2); while (bytes.readRemaining() > 0) { long fieldNum = bytes.parseLong(); long pos = bytes.readPosition(); searchForTheEndOfField(bytes); long end = bytes.readPosition() - 1; bytes.readLimit(end); bytes.readPosition(pos); handler.completeMessage(bytes); handler.onField(fieldNum, bytes); bytes.readLimit(limit); bytes.readPosition(end + 1); } bytes.readLimit(limit); bytes.readPosition(limit2); } FixSaxParser(FixHandler handler); @Override void reset(); @Override void parse(Bytes bytes);  }### Answer:
@Test public void testParseSingleOrder() { String s = "8=FIX.4.2|9=130|35=D|34=659|49=BROKER04|56=REUTERS|52=20070123-19:09:43|38=1000|59=1|100=N|40=1|11=ORD10001|60=20070123-19:01:17|55=HPQ|54=1|21=2|10=004|"; Bytes bbb = Bytes.from(s.replace('|', '\u0001')); final StringBuilder sb = new StringBuilder(); FixSaxParser parser = new FixSaxParser(new FixHandler() { @Override public void onField(long fieldNumber, Bytes value) { sb.append(fieldNumber).append("=") .append(value.toString()).append("|"); } @Override public void completeMessage(Bytes bytes) { } });parser.parse(bbb); assertEquals(s, sb.toString()); }
@Test public void timeParseSingleOrder() { String s = "8=FIX.4.2|9=130|35=D|34=659|49=BROKER04|56=REUTERS|52=20070123-19:09:43|38=1000|59=1|100=N|40=1|11=ORD10001|60=20070123-19:01:17|55=HPQ|54=1|21=2|10=004|"; Bytes nb = Bytes.from(s.replace('|', '\u0001')); final AtomicInteger count = new AtomicInteger(); FixSaxParser parser = new FixSaxParser(new MyFixHandler(count)); int runs = 200000; for (int t = 0; t < 5; t++) { count.set(0); long start = System.nanoTime(); for (int i = 0; i < runs; i++) { nb.readPosition(0); parser.parse(nb); } long time = System.nanoTime() - start; System.out.printf("Average parse time was %.2f us, fields per message %.2f%n", time / runs / 1e3, (double) count.get() / runs); } }