RFR: 8306842: Classfile API performance improvements [v5]
Glavo
duke at openjdk.org
Mon May 15 19:08:55 UTC 2023
On Mon, 15 May 2023 14:48:58 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 two additional commits since the last revision:
>
> - changed LinkedList to ArrayList in RebuildMethodBodies benchmark
> - added RepeatedModelTraversal JMH benchmark
test/micro/org/openjdk/bench/jdk/classfile/RepeatedModelTraversal.java line 54:
> 52: @Setup(Level.Trial)
> 53: public void setup() throws IOException {
> 54: models = new LinkedList<>();
I think `ArrayList` can be used instead of `LinkedList` here too.
While this may not be an actual improvement, I don't think `LinkedList` should be used unless necessary.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13671#discussion_r1194256653
More information about the core-libs-dev
mailing list