RFR: 8306842: Classfile API performance improvements [v8]
Chen Liang
liach at openjdk.org
Wed May 17 13:49:53 UTC 2023
On Wed, 17 May 2023 13:41:16 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 with a new target base due to a merge or a rebase. The pull request now contains 34 commits:
>
> - Merge branch 'master' into JDK-8306842-perf-improvements
>
> # Conflicts:
> # make/RunTests.gmk
> # src/java.base/share/classes/jdk/internal/classfile/impl/Util.java
> - LinkedList replaced with ArrayList in benchmarks
> - Apply suggestions from code review
>
> Co-authored-by: Andrey Turbanov <turbanoff at gmail.com>
> - changed LinkedList to ArrayList in RebuildMethodBodies benchmark
> - added RepeatedModelTraversal JMH benchmark
> - fixed jmh benchmark parameters
> - fixed StackMapGenerator
> - Apply suggestions from code review
>
> Co-authored-by: liach <7806504+liach at users.noreply.github.com>
> - Merge branch 'master' of https://github.com/openjdk/jdk into JDK-8306842-perf-improvements
>
> # Conflicts:
> # src/java.base/share/classes/jdk/internal/classfile/impl/DirectCodeBuilder.java
> # src/java.base/share/classes/jdk/internal/classfile/impl/StackCounter.java
> # src/java.base/share/classes/jdk/internal/classfile/impl/StackMapGenerator.java
> # test/jdk/jdk/classfile/DiscontinuedInstructionsTest.java
> # test/jdk/jdk/classfile/StackMapsTest.java
> - more use of MethodInfo::methodTypeSymbol and faster ClassDesc slot size calculation
> - ... and 24 more: https://git.openjdk.org/jdk/compare/5763be72...d99e7ad0
test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java line 56:
> 54: "--add-exports", "java.base/jdk.internal.classfile.constantpool=ALL-UNNAMED",
> 55: "--add-exports", "java.base/jdk.internal.classfile.instruction=ALL-UNNAMED",
> 56: "--add-exports", "java.base/jdk.internal.classfile.java.lang.constant=ALL-UNNAMED",
Here
test/micro/org/openjdk/bench/jdk/classfile/GenerateStackMaps.java line 64:
> 62: "--add-exports", "java.base/jdk.internal.classfile.constantpool=ALL-UNNAMED",
> 63: "--add-exports", "java.base/jdk.internal.classfile.instruction=ALL-UNNAMED",
> 64: "--add-exports", "java.base/jdk.internal.classfile.java.lang.constant=ALL-UNNAMED",
Same here
test/micro/org/openjdk/bench/jdk/classfile/Write.java line 76:
> 74: "--add-exports", "java.base/jdk.internal.classfile.constantpool=ALL-UNNAMED",
> 75: "--add-exports", "java.base/jdk.internal.classfile.instruction=ALL-UNNAMED",
> 76: "--add-exports", "java.base/jdk.internal.classfile.java.lang.constant=ALL-UNNAMED",
Since this package is gone, this export arg can be removed. There are a total of 3 occurrences I think.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13671#discussion_r1196545864
PR Review Comment: https://git.openjdk.org/jdk/pull/13671#discussion_r1196545744
PR Review Comment: https://git.openjdk.org/jdk/pull/13671#discussion_r1196545664
More information about the core-libs-dev
mailing list