RFR: 8285633: Take better advantage of generic MethodType cache
Jorn Vernee
jvernee at openjdk.java.net
Tue Apr 26 19:33:53 UTC 2022
On Tue, 26 Apr 2022 17:20:55 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> test/micro/org/openjdk/bench/java/lang/invoke/MethodTypeAcquire.java line 104:
>>
>>> 102: @Benchmark
>>> 103: public MethodType testMultiPType_ObjectOnly() {
>>> 104: return MethodType.methodType(Object.class, Object.class, Object.class, Object.class, Object.class, Object.class, Object.class);
>>
>> It might be interesting to add a benchmark where all types are `Object`, but non-constants, to see if that case improves as well.
>
> Right.. I did a quick experiment and there's a large speed-up in the trivial `methodType(obj, obj)` case:
>
> Benchmark Mode Cnt Score Error Units
> MethodTypeAcquire.testObjectObjectNonConstant avgt 5 30.052 ? 3.440 ns/op # baseline
> MethodTypeAcquire.testObjectObjectNonConstant avgt 5 1.171 ? 0.001 ns/op # patch
>
>
> I'll add a non-constant variant for the multi-arg Object variants, too. It should scale linearly and see a gain in the same ballpark. I think we need to keep the number of microbenchmarks here somewhat under control, though.
That sounds good, thanks
-------------
PR: https://git.openjdk.java.net/jdk/pull/8398
More information about the core-libs-dev
mailing list