RFR: 8287442: Reduce list to array conversions in java.lang.invoke.MethodHandles
Claes Redestad
redestad at openjdk.java.net
Fri May 27 14:29:41 UTC 2022
On Fri, 27 May 2022 14:18:19 GMT, Claes Redestad <redestad at openjdk.org> wrote:
> In preparation of #8855 this PR refactors the conversions from `List` to array and array to `List`, reducing the number of conversions when calling `MethodHandles.dropArguments` in particular. This remove about ~5% of allocations on the `StringConcatFactoryBootstraps` microbenchmark.
Another datapoint is the `MethodHandlesDropArguments.interCreate` microbenchmark which explicitly tests `MethodHandles.dropArguments` (with a minimal argument list):
Before:
Benchmark Mode Cnt Score Error Units
MethodHandlesDropArguments.interCreate avgt 5 136.778 ? 1.265 ns/op
MethodHandlesDropArguments.interCreate:?gc.alloc.rate.norm avgt 5 264.020 ? 0.021 B/op
Patch:
Benchmark Mode Cnt Score Error Units
MethodHandlesDropArguments.interCreate avgt 5 120.536 ? 3.133 ns/op
MethodHandlesDropArguments.interCreate:?gc.alloc.rate.norm avgt 5 220.818 ? 41.309 B/op
-------------
PR: https://git.openjdk.java.net/jdk/pull/8923
More information about the core-libs-dev
mailing list