|
18 | 18 |
|
19 | 19 | import org.openjdk.jmh.annotations.Benchmark; |
20 | 20 | import org.openjdk.jmh.annotations.BenchmarkMode; |
| 21 | +import org.openjdk.jmh.annotations.Fork; |
| 22 | +import org.openjdk.jmh.annotations.Measurement; |
21 | 23 | import org.openjdk.jmh.annotations.Mode; |
22 | 24 | import org.openjdk.jmh.annotations.OutputTimeUnit; |
23 | 25 | import org.openjdk.jmh.annotations.Scope; |
24 | 26 | import org.openjdk.jmh.annotations.State; |
| 27 | +import org.openjdk.jmh.annotations.Warmup; |
25 | 28 | import org.openjdk.jmh.infra.Blackhole; |
26 | 29 |
|
27 | 30 | import java.util.concurrent.TimeUnit; |
@@ -50,23 +53,16 @@ public class StringUtilsStripTest { |
50 | 53 | static final String[] strings = buildStrings(); |
51 | 54 |
|
52 | 55 | private static String[] buildStrings() { |
53 | | - String[] res = new String[128 * 128 * 128 * 128]; |
| 56 | + String[] res = new String[128 * 128 * 128]; |
54 | 57 | for (int i = 0; i < 128; i++) { |
55 | 58 | for (int j = 0; j < 128; j++) { |
56 | 59 | for (int k = 0; k < 128; k++) { |
57 | | - for (int l = 0; l < 128; l++) { |
58 | | - StringBuilder stringBuilder = new StringBuilder(); |
59 | | - stringBuilder.append((char) i); |
60 | | - stringBuilder.append((char) j); |
61 | | - stringBuilder.append((char) k); |
62 | | - stringBuilder.append((char) l); |
63 | | - |
64 | | - res[128 * 128 * 128 * i |
65 | | - + 128 * 128 * j |
66 | | - + 128 * k |
67 | | - + l |
68 | | - ] = stringBuilder.toString(); |
69 | | - } |
| 60 | + StringBuilder stringBuilder = new StringBuilder(); |
| 61 | + stringBuilder.append((char) i); |
| 62 | + stringBuilder.append((char) j); |
| 63 | + stringBuilder.append((char) k); |
| 64 | + |
| 65 | + res[128 * 128 * i + 128 * j + k] = stringBuilder.toString(); |
70 | 66 | } |
71 | 67 | } |
72 | 68 | } |
|
0 commit comments