This was unexpected noticed when do the PR #14878.
The PR #14878 disabled assertion by default for JMH tests, which aligned with the common production settings.
That change may affect some benchmark results, for example, the ByteBufAllocatorConcurrentBenchmark to compare performance betweenPooledByteBufAllocator.DEFAULT and adaptiveAllocator: (with JDK-17, M1 chip, 8 cores, 16G RAM)
Before PR:
Benchmark (size) Mode Cnt Score Error Units
ByteBufAllocatorConcurrentBenchmark.allocateReleaseAdaptive 00064 thrpt 20 86231768.383 ± 11380104.655 ops/s
ByteBufAllocatorConcurrentBenchmark.allocateReleaseAdaptive 00256 thrpt 20 66344453.516 ± 7880299.523 ops/s
ByteBufAllocatorConcurrentBenchmark.allocateReleaseAdaptive 01024 thrpt 20 74466000.545 ± 2760686.046 ops/s
ByteBufAllocatorConcurrentBenchmark.allocateReleaseAdaptive 04096 thrpt 20 62714323.129 ± 18474124.550 ops/s
ByteBufAllocatorConcurrentBenchmark.allocateReleasePooled 00064 thrpt 20 61425921.135 ± 5594520.883 ops/s
ByteBufAllocatorConcurrentBenchmark.allocateReleasePooled 00256 thrpt 20 63096846.621 ± 4574851.790 ops/s
ByteBufAllocatorConcurrentBenchmark.allocateReleasePooled 01024 thrpt 20 56776682.109 ± 3068264.099 ops/s
ByteBufAllocatorConcurrentBenchmark.allocateReleasePooled 04096 thrpt 20 67311458.665 ± 912472.494 ops/s
After PR:
Benchmark (size) Mode Cnt Score Error Units
ByteBufAllocatorConcurrentBenchmark.allocateReleaseAdaptive 00064 thrpt 20 82133101.607 ± 3019206.156 ops/s
ByteBufAllocatorConcurrentBenchmark.allocateReleaseAdaptive 00256 thrpt 20 89869155.325 ± 18547254.496 ops/s
ByteBufAllocatorConcurrentBenchmark.allocateReleaseAdaptive 01024 thrpt 20 63534329.364 ± 1097248.608 ops/s
ByteBufAllocatorConcurrentBenchmark.allocateReleaseAdaptive 04096 thrpt 20 76226536.182 ± 2291379.662 ops/s
ByteBufAllocatorConcurrentBenchmark.allocateReleasePooled 00064 thrpt 20 89168684.647 ± 524291.239 ops/s
ByteBufAllocatorConcurrentBenchmark.allocateReleasePooled 00256 thrpt 20 73949586.496 ± 511747.281 ops/s
ByteBufAllocatorConcurrentBenchmark.allocateReleasePooled 01024 thrpt 20 73877283.124 ± 429980.373 ops/s
ByteBufAllocatorConcurrentBenchmark.allocateReleasePooled 04096 thrpt 20 89362198.398 ± 447059.402 ops/s
As we can see, the performance of PooledByteBufAllocator.DEFAULT improved(+15% ~ +45%) after the PR, and its performance numbers become compatible with adaptiveAllocator after the PR.
There might be other jmh-tests need to be re-evaluated.
This is more like a gentle reminder/discussion rather than an issue, so feel free to close it.