On Mon, 29 Apr 2024 12:18:15 GMT, Chen Liang <li...@openjdk.org> wrote:

>> Claes Redestad has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Descriptors can't be empty, optimize isArray and isClassOrInterface with 
>> descriptorString().charAt(0) ==
>
> src/java.base/share/classes/java/lang/constant/MethodTypeDescImpl.java line 
> 74:
> 
>> 72: 
>> 73:         for (ClassDesc cd : trustedArgTypes)
>> 74:             if (cd.descriptorString().equals("V")) // implicit null check
> 
> Just curious, is `equals` faster than `charAt(0) ==` for single-char strings?

I've not benchmarked this detail in JMH, only verified it does less work when 
interpreted. We could probably just drop `cd.isPrimitive() &&`, though, since a 
descriptor of length > 1 starting with `V` can't be created.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18991#discussion_r1583007082

Reply via email to