<i18n dev> RFR: 8302871: Speed up StringLatin1.regionMatchesCI [v7]
Martin Buchholz
martin at openjdk.org
Wed Feb 22 16:13:19 UTC 2023
On Wed, 22 Feb 2023 07:12:35 GMT, Eirik Bjorsnos <duke at openjdk.org> wrote:
>>> Do you have an opinion on the appropriate level of documentation / comments for this kind of 'tricky' code?
>>
>> This code is not that tricky! And the proposed level of documentation is excessive! A couple of lines of explanation and perhaps a link to an external document would be good.
>>
>> It often happens to me that I will write such exhaustive notes for myself when learning a new technology. A year later I pare it all back because much of it is "obvious in retrospect".
>
> Thanks Martin, David, Alan. This was instructive (and fun!)
>
> I suggest we condense the comment to something like this:
>
>
> // Uppercase b1 by removing a single bit
> int upper = b1 & 0xDF;
> if (upper < 'A') {
> return false; // Low ASCII
> }
> ...
>
>
> The similar methods `toLowerCase` `toUpperCase` just above have been updated to follow the same style. (I also updated local variable names there to align better with equalsIgnoreCase)
// ASCII and Latin-1 were designed to optimize case-twiddling operations
-------------
PR: https://git.openjdk.org/jdk/pull/12632
More information about the i18n-dev
mailing list