@@ -0,0 +1,1507 @@
+/*%0A * To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage org.anarres.parallelgzip;%0A%0Aimport com.google.common.base.Stopwatch;%0Aimport com.google.common.io.ByteStreams;%0Aimport java.io.OutputStream;%0Aimport java.util.Random;%0Aimport java.util.concurrent.TimeUnit;%0Aimport org.junit.Ignore;%0Aimport org.junit.Test;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A/**%0A *%0A * @author shevek%0A */%0A@Ignore%0Apublic class ParallelGZIPPerformanceTest %7B%0A%0A    private static final Logger LOG = LoggerFactory.getLogger(ParallelGZIPPerformanceTest.class);%0A%0A    @Test%0A    public void testThreads() throws Exception %7B%0A        LOG.info(%22AvailableProcessors = %22 + Runtime.getRuntime().availableProcessors());%0A        Random r = new Random();%0A        byte%5B%5D data = new byte%5B1024 * 1024%5D;%0A        r.nextBytes(data);%0A        for (int i = 0; i %3C data.length; i++)%0A            data%5Bi%5D = (byte) (data%5Bi%5D & 0x7f);  // Strip the top bit to make it amenable to Huffman compression.%0A%0A        OutputStream out = ByteStreams.nullOutputStream();%0A        ParallelGZIPOutputStream gzip = new ParallelGZIPOutputStream(out);%0A        Stopwatch stopwatch = Stopwatch.createStarted();%0A%0A        for (int i = 0; i %3C 1024 * 20; i++) %7B%0A            gzip.write(data);%0A        %7D%0A        gzip.close();%0A%0A        long elapsed = stopwatch.elapsed(TimeUnit.MILLISECONDS);%0A        LOG.info(%22elapsed=%22 + elapsed);%0A    %7D%0A%7D%0A

Add performance test for use with profilers.