On Tue, 26 May 2026 08:24:22 GMT, Andrey Turbanov <[email protected]> wrote:

>> This PR proposes to swap the pattern-matching switch in `LazyConstant` with 
>> an if rake to reduce startup time.
>> 
>> The PR also adds a missing `@DontInline` annotation on the slow path.
>> 
>> Performance runs across several platforms suggest a ~20-30% startup 
>> improvement for noop.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> src/java.base/share/classes/jdk/internal/lang/LazyConstantImpl.java line 96:
> 
>> 94:                 final Object cf = computingFunctionOrExceptionType;
>> 95:                 // Don't use pattern matching here in order to improve 
>> startup time.
>> 96:                 if (cf instanceof Supplier<?> computingFunction) {
> 
> But here you do use pattern matching for instanceof...

Pattern matching `instanceof` is lowered directly into byte code by javac, it 
doesn't need bootstrapping like the `switch` variant does.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31275#discussion_r3303551334

Reply via email to