RFR: 8306842: Classfile API performance improvements [v3]
Claes Redestad
redestad at openjdk.org
Tue May 9 16:11:25 UTC 2023
On Tue, 9 May 2023 16:09:14 GMT, Adam Sotona <asotona at openjdk.org> wrote:
>> Following improvements implemented:
>> - Switch over `String` replaced with switch single char
>> - Binary search for frames in `StackMapGenerator`
>> - `StackMapGenerator.rawHandlers` with pre-calculated offsets
>> - `ClassEntry` is caching `ClassDesc` symbol
>> - Caching of type symbols in `NameAndTypeEntry` and `MethodTypeEntry`
>> - Caching `MethodTypeDesc` in `MethodInfo` implementations
>> - `StackMapGenerator` and `Utils` delegating to cached `MethodTypeDesc` instead of custom parsing
>>
>> No API change.
>>
>> Benchmarks show stack map generation improved by 21% and code generation from symbols improved by 30%.
>>
>>
>> Benchmark Mode Cnt Score Error Units
>> GenerateStackMaps.benchmark thrpt 10 407931.202 ± 13101.023 ops/s
>> RebuildMethodBodies.shared thrpt 4 10258.597 ± 383.699 ops/s
>> RebuildMethodBodies.unshared thrpt 4 7224.543 ± 256.800 ops/s
>>
>>
>>
>> Benchmark Mode Cnt Score Error Units
>> GenerateStackMaps.benchmark thrpt 10 495101.110 ± 2389.628 ops/s
>> RebuildMethodBodies.shared thrpt 4 13380.272 ± 810.113 ops/s
>> RebuildMethodBodies.unshared thrpt 4 9399.863 ± 557.060 ops/s
>
> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
>
> fixed StackMapGenerator
I'm having a look, but hit an early hurdle in that the microbenchmarks under org/openjdk/bench/jdk/classfile all seem to be missing necessary `--add-opens` flags. Micros should be runnable without any extra flags on the command line.
test/micro/org/openjdk/bench/jdk/classfile/RebuildMethodBodies.java line 42:
> 40: @BenchmarkMode(Mode.Throughput)
> 41: @State(Scope.Benchmark)
> 42: @Fork(value = 1, jvmArgsAppend = {"--enable-preview"})
Suggestion:
@Fork(value = 1, jvmArgsAppend = {"--enable-preview",
"--add-opens", "java.base/jdk.internal.classfile=ALL-UNNAMED",
"--add-opens", "java.base/jdk.internal.classfile.constantpool=ALL-UNNAMED",
"--add-opens", "java.base/jdk.internal.classfile.instruction=ALL-UNNAMED"})
-------------
PR Review: https://git.openjdk.org/jdk/pull/13671#pullrequestreview-1418960199
PR Review Comment: https://git.openjdk.org/jdk/pull/13671#discussion_r1188810244
More information about the core-libs-dev
mailing list