RFR: 8306842: Classfile API performance improvements
Adam Sotona
asotona at openjdk.org
Tue May 9 14:15:52 UTC 2023
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
-------------
Commit messages:
- Merge branch 'master' of https://github.com/openjdk/jdk into JDK-8306842-perf-improvements
- more use of MethodInfo::methodTypeSymbol and faster ClassDesc slot size calculation
- merge from master
- StackMapGenerator::processInvokeInstructions uses cached MethodTypeDesc
- caching MethodTypeDesc in MethodInfo implementations and improved Util methods
- getting symbols from NaTEntry moved to new Util::fieldTypeSymbol and Util::methodTypeSymbol methods
- new RebuildMethodBodies benchmark
- fixed Util::entryList
- Apply suggestions from code review
- caching type symbols in NameAndTypeEntry and MethodTypeEntry
- ... and 16 more: https://git.openjdk.org/jdk/compare/a05560d9...ca4c00d4
Changes: https://git.openjdk.org/jdk/pull/13671/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13671&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8306842
Stats: 476 lines in 23 files changed: 283 ins; 83 del; 110 mod
Patch: https://git.openjdk.org/jdk/pull/13671.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13671/head:pull/13671
PR: https://git.openjdk.org/jdk/pull/13671
More information about the core-libs-dev
mailing list