<i18n dev> Integrated: 8302871: Speed up StringLatin1.regionMatchesCI

Eirik Bjorsnos duke at openjdk.org
Sat Feb 25 07:51:16 UTC 2023


On Sat, 18 Feb 2023 09:21:25 GMT, Eirik Bjorsnos <duke at openjdk.org> wrote:

> This PR suggests we can speed up `StringLatin1.regionMatchesCI` by applying 'the oldest ASCII trick in the book'.
> 
> The new static method `CharacterDataLatin1.equalsIgnoreCase` compares two latin1 bytes for equality ignoring case. `StringLatin1.regionMatchesCI` is updated to use `equalsIgnoreCase`
> 
> To verify the correctness of `equalsIgnoreCase`, a new test is added  to `EqualsIgnoreCase` with an exhaustive verification that all 256x256 latin1 code point pairs have an `equalsIgnoreCase` consistent with Character.toUpperCase, Character.toLowerCase.
> 
> Performance is tested for matching and mismatching cases of code point pairs picked from the ASCII letter, ASCII number and latin1 letter ranges. Results in the first comment below.

This pull request has now been integrated.

Changeset: 17e3769e
Author:    Eirik Bjorsnos <eirbjo at gmail.com>
Committer: Alan Bateman <alanb at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/17e3769ed7190c3ba885e6434e1811bca2d66f13
Stats:     166 lines in 4 files changed: 148 ins; 5 del; 13 mod

8302871: Speed up StringLatin1.regionMatchesCI

Reviewed-by: redestad, martin, alanb

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

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


More information about the i18n-dev mailing list