<i18n dev> RFR: 8302871: Speed up StringLatin1.regionMatchesCI [v7]

Martin Buchholz martin at openjdk.org
Wed Feb 22 00:53:35 UTC 2023


On Wed, 22 Feb 2023 00:45:52 GMT, Martin Buchholz <martin at openjdk.org> wrote:

>> There are still some books on this :) but from wikipedia:
>>> during May 1963 the CCITT Working Party on the New Telegraph Alphabet proposed to assign lowercase characters to sticks[[a]](https://en.wikipedia.org/wiki/ASCII#cite_note-NB_Stick-15)[[14]](https://en.wikipedia.org/wiki/ASCII#cite_note-Bemer_1980_Inside-14) 6 and 7,[[15]](https://en.wikipedia.org/wiki/ASCII#cite_note-CCITT_1963-16) and [International Organization for Standardization](https://en.wikipedia.org/wiki/International_Organization_for_Standardization) TC 97 SC 2 voted during October to incorporate the change into its draft standard.[[16]](https://en.wikipedia.org/wiki/ASCII#cite_note-ISO_1963-17) The X3.2.4 task group voted its approval for the change to ASCII at its May 1963 meeting.[[17]](https://en.wikipedia.org/wiki/ASCII#cite_note-18) **Locating the lowercase letters in sticks[[a]](https://en.wikipedia.org/wiki/ASCII#cite_note-NB_Stick-15)[[14]](https://en.wikipedia.org/wiki/ASCII#cite_note-Bemer_1980_Inside-14) 6 and 7 caused the characters to differ in bit pattern
  from the upper case by a single bit, which simplified [case-insensitive](https://en.wikipedia.org/wiki/Case-insensitive) character matching and the construction of keyboards and printers.**
>> 
>> Hence the simplicity of the shift key :)
>
> More history: IIRC I originally used 'ASCII trick' when I was truly only cared about ASCII, not Latin1 (e.g. ZipFile.isMetaName) and it's a slight misnomer to use "ASCII" here.  But Latin1 followed the precedent of ASCII.

> 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".

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

PR: https://git.openjdk.org/jdk/pull/12632


More information about the i18n-dev mailing list