On Wed, 4 Sep 2024 11:48:46 GMT, Shaojin Wen <s...@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

Reply via email to