RFR: 8331264: Reduce java.lang.constant initialization overhead [v2]

Chen Liang liach at openjdk.org
Mon Apr 29 12:21:12 UTC 2024


On Mon, 29 Apr 2024 12:14:17 GMT, Claes Redestad <redestad at openjdk.org> wrote:

>> I'm looking at ways at reducing/eliminating startup overheads the classfile API in preparation of #17108, and have pushed a series of enhancements to that effect already. This PR is a collection of minor improvements which add up to a 1.5% reduction in retired instructions - or a 5% reduction in executed bytecode - on a simple lambda startup test.
>
> 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?

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

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


More information about the core-libs-dev mailing list