-
Notifications
You must be signed in to change notification settings - Fork 618
JMH benchmark for #39 and #42
Christoph John edited this page May 9, 2018
·
11 revisions
Just wanted to keep this here for further reference.
With #39 and #42 there were some changes done to have less GC happen and to improve the general Message.toString() performance.
Here are the files used. Just package them into a new JMH benchmark project and then use
- mvn clean install
- java -jar target/benchmarks.jar -prof gc
JMH benchmark
Message.java - the improved method is called toString2()
FieldMap.java
NumbersCache.java
Some example results where we can see that the troughput has been improved as well as the GC count and time is lower with the new method.
Benchmark Mode Cnt Score Error Units
MyBenchmark.testNewToString thrpt 200 210499.265 ± 3857.339 ops/s
MyBenchmark.testNewToString:·gc.alloc.rate thrpt 200 248.304 ± 4.549 MB/sec
MyBenchmark.testNewToString:·gc.alloc.rate.norm thrpt 200 1856.002 ± 0.001 B/op
MyBenchmark.testNewToString:·gc.churn.PS_Eden_Space thrpt 200 252.547 ± 20.310 MB/sec
MyBenchmark.testNewToString:·gc.churn.PS_Eden_Space.norm thrpt 200 1885.374 ± 144.966 B/op
MyBenchmark.testNewToString:·gc.churn.PS_Survivor_Space thrpt 200 0.014 ± 0.004 MB/sec
MyBenchmark.testNewToString:·gc.churn.PS_Survivor_Space.norm thrpt 200 0.107 ± 0.032 B/op
MyBenchmark.testNewToString:·gc.count thrpt 200 330.000 counts
MyBenchmark.testNewToString:·gc.time thrpt 200 237.000 ms
MyBenchmark.testOldToString thrpt 200 141528.707 ± 2649.763 ops/s
MyBenchmark.testOldToString:·gc.alloc.rate thrpt 200 586.761 ± 10.672 MB/sec
MyBenchmark.testOldToString:·gc.alloc.rate.norm thrpt 200 6524.003 ± 8.524 B/op
MyBenchmark.testOldToString:·gc.churn.PS_Eden_Space thrpt 200 586.614 ± 11.655 MB/sec
MyBenchmark.testOldToString:·gc.churn.PS_Eden_Space.norm thrpt 200 6522.385 ± 53.678 B/op
MyBenchmark.testOldToString:·gc.churn.PS_Survivor_Space thrpt 200 0.104 ± 0.008 MB/sec
MyBenchmark.testOldToString:·gc.churn.PS_Survivor_Space.norm thrpt 200 1.167 ± 0.098 B/op
MyBenchmark.testOldToString:·gc.count thrpt 200 2748.000 counts
MyBenchmark.testOldToString:·gc.time thrpt 200 1835.000 ms