On Fri, 27 May 2022 14:18:19 GMT, Claes Redestad <redes...@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.

src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 5266:

> 5264:      */
> 5265:     public static MethodHandle dropArguments(MethodHandle target, int 
> pos, List<Class<?>> valueTypes) {
> 5266:         return dropArguments(target, pos, valueTypes.toArray(new 
> Class<?>[0]).clone(), true);

Isn't this call to `clone()` unnecessary, as `valueTypes.toArray` should either 
return the passed empty array, or a newly created array?


PR: https://git.openjdk.java.net/jdk/pull/8923

Reply via email to