RFR: 8339290: Optimize ClassFile Utf8EntryImpl#writeTo [v15]

Claes Redestad redestad at openjdk.org
Tue Sep 3 14:56:21 UTC 2024


On Tue, 3 Sep 2024 13:22:41 GMT, Shaojin Wen <swen at openjdk.org> wrote:

>> Use fast path for ascii characters 1 to 127 to improve the performance of writing Utf8Entry to BufferWriter.
>
> Shaojin Wen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   countGreaterThanZero -> CountNonNegatives

src/java.base/share/classes/java/lang/StringCoding.java line 41:

> 39:      * Count the number of String::value leading non-negatives in the range.
> 40:      */
> 41:     public static int countNonNegatives(String s) {

No, this is wrong, `NonNegatives` implies zeroes. I meant that `countPositives` should be renamed `countNonNegatives` in a future enhancement to more precisely reflect what it does. That's finicky since it's intrinsified and requires coordination with runtime code, though.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20772#discussion_r1742216866


More information about the core-libs-dev mailing list