Rewrite AtomicRangeInteger for higher performance (#2874)
Typical test benchmark for performance improvement. Check PR for more detail.
/**
* # JMH version: 1.21
* # VM version: JDK 1.8.0_111, Java HotSpot(TM) 64-Bit Server VM, 25.111-b14
* # VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre/bin/java
* # VM options: -Dfile.encoding=UTF-8
* # Warmup: 3 iterations, 10 s each
* # Measurement: 5 iterations, 1000 ms each, 1000 calls per op
* # Timeout: 10 min per iteration
* # Threads: 1024 threads, ***WARNING: Synchronize iterations are disabled!***
* # Benchmark mode: Throughput, ops/time
* # Benchmark: org.apache.skywalking.apm.commons.datacarrier.common.AtomicRangeIntegerTest.testNewGetAndIncrementPerformance
*
* # Run progress: 0.00% complete, ETA 00:01:10
* # Fork: 1 of 1
* # Warmup Iteration 1: 2078993549.108 ops/s
* # Warmup Iteration 2: 6408026002.297 ops/s
* # Warmup Iteration 3: 5455960135.636 ops/s
* Iteration 1: 165330.972 ops/s
* Iteration 2: 95420.526 ops/s
* Iteration 3: 173340.089 ops/s
* Iteration 4: 94214.669 ops/s
* Iteration 5: 261606.088 ops/s
*
*
* Result "org.apache.skywalking.apm.commons.datacarrier.common.AtomicRangeIntegerTest.testNewGetAndIncrementPerformance":
* 157982.469 ±(99.9%) 265443.465 ops/s [Average]
* (min, avg, max) = (94214.669, 157982.469, 261606.088), stdev = 68934.825
* CI (99.9%): [≈ 0, 423425.934] (assumes normal distribution)
*
*
* # JMH version: 1.21
* # VM version: JDK 1.8.0_111, Java HotSpot(TM) 64-Bit Server VM, 25.111-b14
* # VM invoker: /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre/bin/java
* # VM options: -Dfile.encoding=UTF-8
* # Warmup: 3 iterations, 10 s each
* # Measurement: 5 iterations, 1000 ms each, 1000 calls per op
* # Timeout: 10 min per iteration
* # Threads: 1024 threads, ***WARNING: Synchronize iterations are disabled!***
* # Benchmark mode: Throughput, ops/time
* # Benchmark: org.apache.skywalking.apm.commons.datacarrier.common.AtomicRangeIntegerTest.testOriGetAndIncrementPerformance
*
* # Run progress: 50.00% complete, ETA 00:00:43
* # Fork: 1 of 1
* # Warmup Iteration 1: 3345520433.355 ops/s
* # Warmup Iteration 2: 4823749249.799 ops/s
* # Warmup Iteration 3: 6676209367.819 ops/s
* Iteration 1: 34885.954 ops/s
* Iteration 2: 33128.147 ops/s
* Iteration 3: 31300.865 ops/s
* Iteration 4: 19188.602 ops/s
* Iteration 5: 34664.282 ops/s
*
*
* Result "org.apache.skywalking.apm.commons.datacarrier.common.AtomicRangeIntegerTest.testOriGetAndIncrementPerformance":
* 30633.570 ±(99.9%) 25249.253 ops/s [Average]
* (min, avg, max) = (19188.602, 30633.570, 34885.954), stdev = 6557.151
* CI (99.9%): [5384.317, 55882.822] (assumes normal distribution)
*
*
* # Run complete. Total time: 00:01:26
*
* REMEMBER: The numbers below are just data. To gain reusable insights, you need to follow up on
* why the numbers are the way they are. Use profilers (see -prof, -lprof), design factorial
* experiments, perform baseline and negative tests that provide experimental control, make sure
* the benchmarking environment is safe on JVM/OS/HW level, ask for reviews from the domain experts.
* Do not assume the numbers tell you what you want them to tell.
*
* Benchmark Mode Cnt Score Error Units
* AtomicRangeIntegerTest.testNewGetAndIncrementPerformance thrpt 5 157982.469 ± 265443.465 ops/s
* AtomicRangeIntegerTest.testOriGetAndIncrementPerformance thrpt 5 30633.570 ± 25249.253 ops/s
*/