static <T extends Message<T>> void ser(T message, Serializer serializer, PrintStream out,
            String name, int warmups, int loops) throws Exception
    {
        int len = serializer.serialize(message).length;
        for (int i = 0; i < warmups; i++)
            serializer.serialize(message);
        long start = System.currentTimeMillis();
        for (int i = 0; i < loops; i++)
            serializer.serialize(message);
        long finish = System.currentTimeMillis();
        long elapsed = finish - start;
        out.println(elapsed + " ms elapsed with " + len + " bytes for " + name);
    }
Benchmark to compare the serialization speed of 3 types. CodedOutput, BufferedOutput and DeferredOutput.

@author David Yu
@created Nov 13, 2009
protostuff-core/src/test/java/io/protostuff/CompareOutputsTest.java