On Fri, 14 Feb 2025 09:19:35 GMT, Per Minborg <pminb...@openjdk.org> wrote:
> This PR proposes to add `@ForceInline` to the `default` methods in > `SegmentAllocator` that do not already have it. Base: Benchmark Mode Cnt Score Error Units AllocFromInlineTest.alloc00 thrpt 6 476452588.661 ± 7278882.517 ops/s AllocFromInlineTest.alloc01 thrpt 6 478294334.573 ± 12849151.248 ops/s AllocFromInlineTest.alloc02 thrpt 6 478719668.816 ± 15861024.634 ops/s AllocFromInlineTest.alloc03 thrpt 6 478346000.607 ± 8894248.371 ops/s AllocFromInlineTest.alloc04 thrpt 6 477480288.497 ± 24475377.961 ops/s AllocFromInlineTest.alloc05 thrpt 6 478981910.741 ± 10047783.948 ops/s AllocFromInlineTest.alloc06 thrpt 6 479300719.724 ± 14778024.488 ops/s AllocFromInlineTest.alloc07 thrpt 6 480071960.165 ± 13141382.801 ops/s AllocFromInlineTest.alloc08 thrpt 6 370508102.298 ± 15769922.608 ops/s AllocFromInlineTest.alloc09 thrpt 6 282440969.138 ± 7061789.415 ops/s AllocFromInlineTest.alloc10 thrpt 6 270971705.049 ± 7088889.559 ops/s AllocFromInlineTest.alloc11 thrpt 6 269216600.688 ± 11097251.197 ops/s AllocFromInlineTest.alloc12 thrpt 6 155310245.753 ± 2901522.195 ops/s AllocFromInlineTest.alloc13 thrpt 6 155960685.355 ± 3753241.849 ops/s AllocFromInlineTest.alloc14 thrpt 6 158746683.590 ± 1405113.930 ops/s AllocFromInlineTest.alloc15 thrpt 6 133846753.437 ± 110295.996 ops/s Patch: Benchmark Mode Cnt Score Error Units AllocFromInlineTest.alloc00 thrpt 6 470486588.500 ± 19222697.340 ops/s AllocFromInlineTest.alloc01 thrpt 6 476866882.368 ± 18330599.542 ops/s AllocFromInlineTest.alloc02 thrpt 6 480518760.561 ± 10645063.162 ops/s AllocFromInlineTest.alloc03 thrpt 6 479862457.027 ± 12991374.677 ops/s AllocFromInlineTest.alloc04 thrpt 6 480432586.862 ± 11229500.034 ops/s AllocFromInlineTest.alloc05 thrpt 6 480723976.385 ± 7744771.142 ops/s AllocFromInlineTest.alloc06 thrpt 6 481476767.735 ± 13672690.226 ops/s AllocFromInlineTest.alloc07 thrpt 6 478505354.988 ± 9564577.750 ops/s AllocFromInlineTest.alloc08 thrpt 6 369357735.209 ± 11653294.244 ops/s AllocFromInlineTest.alloc09 thrpt 6 281708677.332 ± 10404941.019 ops/s AllocFromInlineTest.alloc10 thrpt 6 271084202.621 ± 7437750.547 ops/s AllocFromInlineTest.alloc11 thrpt 6 271395930.818 ± 6696736.324 ops/s AllocFromInlineTest.alloc12 thrpt 6 156745633.040 ± 4996616.105 ops/s AllocFromInlineTest.alloc13 thrpt 6 157755346.229 ± 4991249.264 ops/s AllocFromInlineTest.alloc14 thrpt 6 154167559.599 ± 2733281.193 ops/s AllocFromInlineTest.alloc15 thrpt 6 157332555.961 ± 2915557.625 ops/s Log output shows for `alloc15`: Base: @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_15 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_14 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_13 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_12 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_11 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_10 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_9 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_8 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_7 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_6 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_5 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_4 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_3 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_2 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_1 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_0 (14 bytes) inline (hot) @ 8 java.lang.foreign.SegmentAllocator::allocateFrom (24 bytes) failed to inline: inlining too deep Patch: @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_15 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_14 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_13 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_12 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_11 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_10 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_9 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_8 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_7 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_6 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_5 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_4 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_3 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_2 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_1 (5 bytes) inline (hot) @ 1 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest::alloc_0 (14 bytes) inline (hot) @ 8 java.lang.foreign.SegmentAllocator::allocateFrom (24 bytes) force inline by annotation late inline succeeded @ 1 java.util.Objects::requireNonNull (14 bytes) force inline by annotation @ 7 java.lang.foreign.SegmentAllocator::allocateNoInit (41 bytes) force inline by annotation @ 35 java.lang.foreign.SegmentAllocator::allocate (24 bytes) force inline by annotation @ 1 java.util.Objects::requireNonNull (14 bytes) force inline by annotation @ 7 jdk.internal.foreign.layout.AbstractLayout::byteSize (5 bytes) accessor @ 13 jdk.internal.foreign.layout.AbstractLayout::byteAlignment (5 bytes) accessor @ 18 org.openjdk.bench.java.lang.foreign.AllocFromInlineTest$FakeArena::allocate (5 bytes) failed to inline: inlining too deep So, with the patch, we can inline in a similar way as the other `default` methods already annotated with `@ForceInline`. ------------- PR Comment: https://git.openjdk.org/jdk/pull/23628#issuecomment-2791638448