1414 */
1515public class FourBitAsciiCompressorBenchmark {
1616
17- private static final AsciiCompressor COMPRESSOR = new FourBitAsciiCompressor (true );
18- private static final int MAX_STRINGS = 128 ; // Must be a power of 2 for bitwise module.
17+ private static final AsciiCompressor COMPRESSOR = new FourBitAsciiCompressor ();
18+ private static final int MAX_STRINGS = 256 ; // Must be a power of 2 for bitwise module.
1919 private static final byte [][] INPUT_STRINGS = new byte [MAX_STRINGS ][];
2020 private static final byte [][] COMPRESSED_STRINGS = new byte [MAX_STRINGS ][];
2121 private static final Random RANDOM = new Random ();
2222
2323 private static int index ;
2424
2525 static {
26- System .out .println (" ### Initializing static data for FourBitAsciiCompressorBenchmark..." );
26+ COMPRESSOR .setPreserveOriginal (true );
27+ COMPRESSOR .setThrowException (false );
2728
2829 int charSetLen = DEFAULT_4BIT_CHARSET .length ;
2930
3031 for (int i = 0 ; i < MAX_STRINGS ; i ++) {
31- byte [] string = new byte [10 * 1024 * 1024 ]; // 10 MB string.
32+ byte [] string = new byte [10 * 1024 * 1024 ]; // 10 MB each string.
3233
3334 for (int j = 0 , len = string .length ; j < len ; j ++)
3435 string [j ] = DEFAULT_4BIT_CHARSET [RANDOM .nextInt (charSetLen )];
@@ -37,7 +38,6 @@ public class FourBitAsciiCompressorBenchmark {
3738 COMPRESSED_STRINGS [i ] = COMPRESSOR .compress (string );
3839 }
3940
40- System .out .println (" ### FourBitAsciiCompressorBenchmark static data initialized." );
4141 }
4242
4343// @Benchmark
@@ -49,10 +49,10 @@ public byte[] compressStrings() {
4949 return COMPRESSOR .compress (INPUT_STRINGS [index ++ & 0x7FFFFFFF & MAX_STRINGS - 1 ]);
5050 }
5151
52- @ Benchmark
53- public byte [] decompressStrings () {
54- return COMPRESSOR .decompress (COMPRESSED_STRINGS [index ++ & 0x7FFFFFFF & MAX_STRINGS - 1 ]);
55- }
52+ // @Benchmark
53+ // public byte[] decompressStrings() {
54+ // return COMPRESSOR.decompress(COMPRESSED_STRINGS[index++ & 0x7FFFFFFF & MAX_STRINGS - 1]);
55+ // }
5656
5757 /**
5858 * For debugging (see JMH in build.gradle.kts).
0 commit comments