RFR: 8285255: refine StringLatin1.regionMatchesCI_UTF16 [v2]

XenoAmess duke at openjdk.java.net
Wed Apr 20 20:09:06 UTC 2022


> some thoughts after watching 8285001: Simplify StringLatin1.regionMatches  https://github.com/openjdk/jdk/pull/8292/
> 
>             if (Character.toLowerCase(u1) == Character.toLowerCase(u2)) {
>                 continue;
>             }
> 
> should be changed to 
> 
>             if (((u1 == c1) ? CharacterDataLatin1.instance.toLowerCase(c1) : c1) == Character.toLowerCase(u2)) {
>                 continue;
>             }
> 
> as:
> 
> 1. c1 is LATIN1, so CharacterDataLatin1.instance.toLowerCase seems faster.
> 2. because c1 is LATIN1, so if u1 != c1, then c1 is already lowercase, and don't need a lowercase cauculation.

XenoAmess has updated the pull request incrementally with one additional commit since the last revision:

  add jmh test

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/8308/files
  - new: https://git.openjdk.java.net/jdk/pull/8308/files/9371519f..ac6d75e4

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=8308&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=8308&range=00-01

  Stats: 59 lines in 1 file changed: 59 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8308.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8308/head:pull/8308

PR: https://git.openjdk.java.net/jdk/pull/8308


More information about the core-libs-dev mailing list