Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e14189a28e4cb71c4449d328d41cca2851f289e4
      
https://github.com/WebKit/WebKit/commit/e14189a28e4cb71c4449d328d41cca2851f289e4
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-05-27 (Wed, 27 May 2026)

  Changed paths:
    A JSTests/microbenchmarks/intl-string-tolocalelowercase.js
    A JSTests/microbenchmarks/intl-string-tolocaleuppercase.js
    A JSTests/stress/to-locale-case-root-fast-path.js
    M Source/JavaScriptCore/runtime/StringPrototype.cpp

  Log Message:
  -----------
  [JSC] Add a root-locale fast path to `toLocaleLowerCase` and 
`toLocaleUpperCase`
https://bugs.webkit.org/show_bug.cgi?id=315630

Reviewed by Yusuke Suzuki.

toLocaleLowerCase / toLocaleUpperCase always went through ICU
(u_strToLower / u_strToUpper) and always upconverted the string to UTF-16,
even when the resolved locale does not affect case mapping.

Unicode case mapping is locale-independent except for the tailoring locales
az, el, lt, and tr. For every other locale (including the "und" root locale
that results when the locale argument is undefined), the result is identical
to the locale-independent ("root") case conversion, which already has
ASCII/Latin-1 fast paths.

                                       TipOfTree                  Patched

intl-string-tolocalelowercase      146.4819+-2.1938     ^     24.6959+-0.5805   
     ^ definitely 5.9314x faster
intl-string-tolocaleuppercase      147.4327+-2.7373     ^     24.9070+-0.9821   
     ^ definitely 5.9193x faster

Tests: JSTests/microbenchmarks/intl-string-tolocalelowercase.js
       JSTests/microbenchmarks/intl-string-tolocaleuppercase.js
       JSTests/stress/to-locale-case-root-fast-path.js

* JSTests/microbenchmarks/intl-string-tolocalelowercase.js: Added.
(test):
* JSTests/microbenchmarks/intl-string-tolocaleuppercase.js: Added.
(test):
* JSTests/stress/to-locale-case-root-fast-path.js: Added.
(shouldBe):
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
(JSC::toLocaleCase):

Canonical link: https://commits.webkit.org/313951@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to