Skip to content

Commit

Permalink
[bench] adjust the benchmarking code to be more meaningful
Browse files Browse the repository at this point in the history
```
Benchmark                                        Mode  Cnt       Score      Error   Units
StringLoopBenchmark.benchLongDecodeStringLoop   thrpt    5   10745.123 ±  194.012  ops/ms
StringLoopBenchmark.benchLongJavaStringLoop     thrpt    5  123630.568 ± 2992.694  ops/ms
StringLoopBenchmark.benchLongRubyStringLoop     thrpt    5   20841.347 ± 1095.569  ops/ms
StringLoopBenchmark.benchShortDecodeStringLoop  thrpt    5   15207.295 ±  933.209  ops/ms
StringLoopBenchmark.benchShortJavaStringLoop    thrpt    5  140604.846 ± 2555.282  ops/ms
StringLoopBenchmark.benchShortRubyStringLoop    thrpt    5  103548.193 ± 3440.039  ops/ms

```
  • Loading branch information
kares committed May 25, 2018
1 parent 1a7a482 commit 7810ba0
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -46,7 +46,8 @@ public void benchShortRubyStringLoop(final Blackhole blackhole) {
@Benchmark
@OperationsPerInvocation(INVOCATIONS)
public void benchShortJavaStringLoop(final Blackhole blackhole) {
for (int i = 0; i < INVOCATIONS; i++) equalsJava(SHORT_STR, SHORT.decodeString(), blackhole);
final String str = SHORT.decodeString();
for (int i = 0; i < INVOCATIONS; i++) equalsJava(SHORT_STR, str, blackhole);
}

@Benchmark
Expand All @@ -64,7 +65,8 @@ public void benchLongRubyStringLoop(final Blackhole blackhole) {
@Benchmark
@OperationsPerInvocation(INVOCATIONS)
public void benchLongJavaStringLoop(final Blackhole blackhole) {
for (int i = 0; i < INVOCATIONS; i++) equalsJava(LONG_STR, LONG.decodeString(), blackhole);
final String str = LONG.decodeString();
for (int i = 0; i < INVOCATIONS; i++) equalsJava(LONG_STR, str, blackhole);
}

@Benchmark
Expand Down

0 comments on commit 7810ba0

Please sign in to comment.