public void testBenchmark() throws Exception
    {
        if (!"false".equals(System.getProperty("benchmark.skip")))
            return;

        String dir = System.getProperty("benchmark.output_dir");

        PrintStream out = dir == null ? System.out :
                new PrintStream(new FileOutputStream(new File(new File(dir),
                        "protostuff-core-" + System.currentTimeMillis() + ".txt"), true));

        int warmups = Integer.getInteger("benchmark.warmups", 200000);
        int loops = Integer.getInteger("benchmark.loops", 2000000);

        String title = "protostuff-core serialization benchmark for " + loops + " runs";
        out.println(title);
        out.println();

        start(foo, SERIALIZERS, out, warmups, loops);

        if (System.out != out)
            out.close();
    }
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