RFR: 8341755: Optimize argNames in InnerClassLambdaMetafactory [v2]

Claes Redestad redestad at openjdk.org
Tue Oct 8 17:52:00 UTC 2024


On Tue, 8 Oct 2024 15:52:35 GMT, Shaojin Wen <swen at openjdk.org> wrote:

>> A simple optimization that eliminates the allocation of the MethodTypeDescImpl object when parameterCount is equal to 0 and eliminates the allocation of argNames when parameterCount is equal to 1
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Lazy initialization of ARG_NAME_CACHE

Looks reasonable

src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java line 193:

> 191:         String argName = i < ARG_NAME_CACHE_SIZE ? ARG_NAME_CACHE[i] : null;
> 192:         if (argName == null) {
> 193:             argName = "arg$".concat(Integer.toString(i + 1));

With `Integer.toString` in the mix perhaps just as well keep this as a standard concat?
Suggestion:

            argName = "arg$" + (i + 1);

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

Marked as reviewed by redestad (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/21399#pullrequestreview-2355130507
PR Review Comment: https://git.openjdk.org/jdk/pull/21399#discussion_r1792264161


More information about the core-libs-dev mailing list