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

Shaojin Wen swen at openjdk.org
Tue Sep 3 14:35:20 UTC 2024


On Tue, 3 Sep 2024 13:45:26 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java line 397:
>> 
>>> 395: 
>>> 396:     /**
>>> 397:      * if string#coder() is Latin1 return the count of string#value() leading greater than zero, else return 0
>> 
>> Can you move this next to `countPositives`? 
>> 
>> Suggestion:
>> 
>>      * Count the number of leading positive, non-zero bytes in the range.
>> 
>> 
>> Technically this new routine is the "real" `countPositives` since, mathematically speaking, zero is neither positive nor negative. It's named like it is because I'm no mathematician, and now it might be better to rename away from that to disambiguate.. If you feel like it then please file an RFE to have `countPositives` renamed to `countNonNegatives`
>
> We might rename these to `countAscii` and `countModifiedUtf8Compatible`.

ascii includes '\0', `CountModifiedUtf8Compatible` Newbies don't seem to know what it means

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

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


More information about the core-libs-dev mailing list