static void deser(PrintStream out, Deserializer deserializer, String name, int warmups,
            int loops) throws Exception
    {
        final byte[] data = deserializer.getSerializer().serialize(foo);
        int len = data.length;
        Foo f = new Foo();
        deserializer.mergeFrom(data, f);
        SerializableObjects.assertEquals(foo, f);

        for (int i = 0; i < warmups; i++)
            deserializer.mergeFrom(data, new Foo());

        long start = System.currentTimeMillis();

        for (int i = 0; i < loops; i++)
            deserializer.mergeFrom(data, new Foo());

        long finish = System.currentTimeMillis();
        long elapsed = finish - start;
        out.println(elapsed + " ms elapsed with " + len + " bytes for " + name);
    }
Benchmark to compare the deserialization speed of 2 types. CodedInput and ByteArrayInput.

@author David Yu
@created Jun 22, 2010
protostuff-core/src/test/java/io/protostuff/CompareInputsTest.java