RFR: 8367005: ImageReader refactor caused performance regressions for startup and footprint [v2]

David Beaumont duke at openjdk.org
Thu Sep 11 10:01:28 UTC 2025


On Thu, 11 Sep 2025 01:19:17 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> David Beaumont has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Found additional place where new API can be used.
>
> src/java.base/share/classes/jdk/internal/jimage/ImageReader.java line 356:
> 
>> 354:             // Unlike findNode(), this method makes only one lookup in the
>> 355:             // underlying jimage, but can only reliably return resource nodes.
>> 356:             if (moduleName.contains("/") || resourcePath.startsWith("/")) {
> 
> Slightly more efficient, here and in `containsResource` below:
> Suggestion:
> 
>             if (moduleName.indexOf('/') >= 0 || resourcePath.indexOf('/') == 0) {

I had thought of these micro optimizations, but I thought we preferred clarity unless performance was proven to be an issue. I see contains("<single-char>") in other code - should we be changing that?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27203#discussion_r2339893442


More information about the core-libs-dev mailing list