RFR: 8287442: Reduce list to array conversions in java.lang.invoke.MethodHandles

ExE Boss duke at openjdk.java.net
Fri May 27 19:31:26 UTC 2022


On Fri, 27 May 2022 16:08:03 GMT, liach <duke at openjdk.java.net> wrote:

> If `parameterList` is too slow for `List.of` copies the backing parameter types array, wouldn't calling `JavaUtilCollectionAccess::listFromTrustedArray` a better alternative, as it only allocates one wrapper and has better performance on `subList` than `Arrays.copyOfRange`?

No, because `listFromTrustedArray` doesn’t allow invocation with array classes other than `Object[].class`:
https://github.com/openjdk/jdk/blob/6520843f86f638fe4d1e5b3358fab5799daca654/src/java.base/share/classes/java/util/ImmutableCollections.java#L195-L222

-------------

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


More information about the core-libs-dev mailing list