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

Eirik Bjorsnos duke at openjdk.org
Tue Feb 21 21:53:10 UTC 2023


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

Eirik Bjorsnos has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 13 additional commits since the last revision:

 - Add whitespace between methods
 - Merge branch 'master' into regionmatches-latin1-speedup
 - Remove whitespace following '('
 - Revert "Spell fix for 'exhaustive' in comments in sun/text/resources"
   
   This reverts commit 5e9927a4b35e157fd3fa72fd2663c8bfbecf32bb.
 - Spell fix for 'exhaustive' in comments in sun/text/resources
 - Add @bug tag to EqualsIgnoreCase test for correct issue JDK-8302871
 - Add @bug tag to EqualsIgnoreCase test for JDK-8302877
 - Add clarifying comments and use more descriptive variable names in the latin1 verification EqualsIgnoreCase test
 - Align whitespace to make example strings easier to read
 - Merge branch 'master' into regionmatches-latin1-speedup
 - ... and 3 more: https://git.openjdk.org/jdk/compare/ea62160f...718fcead

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/12632/files
  - new: https://git.openjdk.org/jdk/pull/12632/files/d7b1c164..718fcead

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=12632&range=07
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=12632&range=06-07

  Stats: 4282 lines in 198 files changed: 2630 ins; 1129 del; 523 mod
  Patch: https://git.openjdk.org/jdk/pull/12632.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/12632/head:pull/12632

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


More information about the i18n-dev mailing list