RFR: 8339290: Optimize ClassFile Utf8EntryImpl#writeTo [v17]
Claes Redestad
redestad at openjdk.org
Wed Sep 4 11:57:21 UTC 2024
On Wed, 4 Sep 2024 11:48:46 GMT, Shaojin Wen <swen at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/classfile/impl/BufWriterImpl.java line 165:
>>
>>> 163: int countNonZeroAscii = JLA.countNonZeroAscii(str);
>>> 164: int utflen = strlen;
>>> 165: if (countNonZeroAscii != strlen) {
>>
>> Perhaps skip the count if `strlen` is already too large (we'll throw in the next block)
>> Suggestion:
>>
>> if (strlen <= 65535 && countNonZeroAscii != strlen) {
>
> Let’s not add this, because normal logic should not pay the cost for abnormal logic
Agreed in principle, but not sure the cost of this quick fail-fast sanity test would be noticeable?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20772#discussion_r1743636412
More information about the core-libs-dev
mailing list