charlesconnell commented on PR #6901:
URL: https://github.com/apache/hbase/pull/6901#issuecomment-2798917002
Sure. The full code is now
```
@State(Scope.Benchmark)
public class ClosureBenchmark {
@Param({ "10000" })
public int loops;
@Param({ "true", "false" })
public boolean createNewClosure;
@Benchmark
public void test(Blackhole blackhole) {
if (createNewClosure) {
for (int i = 0; i < loops; i++) {
IntConsumer newClosure = x -> {
blackhole.consume(x);
};
blackhole.consume(newClosure);
}
} else {
IntConsumer savedClosure = x -> {
blackhole.consume(x);
};
for (int i = 0; i < loops; i++) {
blackhole.consume(savedClosure);
}
}
}
public static void main(String[] args) throws RunnerException, IOException
{
org.openjdk.jmh.Main.main(args);
}
}
```
and the results are similar:
```
Benchmark (createNewClosure)
(loops) Mode Cnt Score Error Units
ClosureBenchmark.test true
10000 thrpt 25 33490.255 ± 278.683 ops/s
ClosureBenchmark.test:·gc.alloc.rate true
10000 thrpt 25 4863.875 ± 40.472 MB/sec
ClosureBenchmark.test:·gc.alloc.rate.norm true
10000 thrpt 25 160003.763 ± 0.593 B/op
ClosureBenchmark.test:·gc.churn.G1_Eden_Space true
10000 thrpt 25 4863.175 ± 43.757 MB/sec
ClosureBenchmark.test:·gc.churn.G1_Eden_Space.norm true
10000 thrpt 25 159981.872 ± 719.752 B/op
ClosureBenchmark.test:·gc.churn.G1_Survivor_Space true
10000 thrpt 25 0.006 ± 0.001 MB/sec
ClosureBenchmark.test:·gc.churn.G1_Survivor_Space.norm true
10000 thrpt 25 0.204 ± 0.040 B/op
ClosureBenchmark.test:·gc.count true
10000 thrpt 25 1411.000 counts
ClosureBenchmark.test:·gc.time true
10000 thrpt 25 852.000 ms
ClosureBenchmark.test false
10000 thrpt 25 37070.851 ± 195.065 ops/s
ClosureBenchmark.test:·gc.alloc.rate false
10000 thrpt 25 0.539 ± 0.003 MB/sec
ClosureBenchmark.test:·gc.alloc.rate.norm false
10000 thrpt 25 16.016 ± 0.022 B/op
ClosureBenchmark.test:·gc.churn.G1_Eden_Space false
10000 thrpt 25 0.761 ± 1.164 MB/sec
ClosureBenchmark.test:·gc.churn.G1_Eden_Space.norm false
10000 thrpt 25 22.643 ± 34.623 B/op
ClosureBenchmark.test:·gc.churn.G1_Survivor_Space false
10000 thrpt 25 0.142 ± 0.216 MB/sec
ClosureBenchmark.test:·gc.churn.G1_Survivor_Space.norm false
10000 thrpt 25 4.212 ± 6.441 B/op
ClosureBenchmark.test:·gc.count false
10000 thrpt 25 5.000 counts
ClosureBenchmark.test:·gc.time false
10000 thrpt 25 10.000 ms
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]