private static void benchmark(
      PrintWriter csvWriter,
      String dataName,
      String codecName,
      IntegerCODEC codec,
      int[][] data,
      int repeat) {
    PerformanceLogger logger = new PerformanceLogger();

    int maxLen = getMaxLen(data);
    int[] compressBuffer = new int[4 * maxLen + 1024];
    int[] decompressBuffer = new int[maxLen];

    for (int i = 0; i < repeat; ++i) {
      for (int[] array : data) {
        int compSize = compress(logger, codec, array, compressBuffer);
        int decompSize = decompress(logger, codec, compressBuffer, compSize, decompressBuffer);
        checkArray(array, decompressBuffer, decompSize, codec);
      }
    }

    if (csvWriter != null) {
      csvWriter.format(
          "\"%1$s\",\"%2$s\",%3$.2f,%4$.0f,%5$.0f\n",
          dataName,
          codecName,
          logger.getBitPerInt(),
          logger.getCompressSpeed(),
          logger.getDecompressSpeed());
    }
  }
 private static int compress(PerformanceLogger logger, IntegerCODEC codec, int[] src, int[] dst) {
   IntWrapper inpos = new IntWrapper();
   IntWrapper outpos = new IntWrapper();
   logger.compressionTimer.start();
   codec.compress(src, inpos, src.length, dst, outpos);
   logger.compressionTimer.end();
   int outSize = outpos.get();
   logger.addOriginalSize(src.length);
   logger.addCompressedSize(outSize);
   return outSize;
 }