[webkit-changes] [WebKit/WebKit] be02cb: [JSC] Optimize DUCET localeCompare fast path

Yusuke Suzuki noreply at github.com
Fri Oct 21 08:36:46 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: be02cb665865d5ff576ba58270478f515de4cad6
      https://github.com/WebKit/WebKit/commit/be02cb665865d5ff576ba58270478f515de4cad6
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2022-10-21 (Fri, 21 Oct 2022)

  Changed paths:
    M Source/JavaScriptCore/runtime/IntlCollator.cpp
    M Source/JavaScriptCore/runtime/IntlObject.cpp
    M Source/JavaScriptCore/runtime/IntlObject.h
    M Source/JavaScriptCore/runtime/IntlObjectInlines.h

  Log Message:
  -----------
  [JSC] Optimize DUCET localeCompare fast path
https://bugs.webkit.org/show_bug.cgi?id=246843
rdar://101411702

Reviewed by Ross Kirsling.

This patch simplifies localeCompare DUCET fast path to accelerate performance.

1. We should fallback while trying the fast path instead of scanning all the code first since this scanning is anyway costly.
   And fallback is much more costly. So, making fast path faster makes sense.
2. Extend the table of DUCET to avoid boundary checks for 8bit characters.
3. Add fast path for equal strings.

This offers 14% improvement in JetStream2/cdjs.

Before:
    Total Score:  199.831
After:
    Total Score:  227.784

* Source/JavaScriptCore/runtime/IntlCollator.cpp:
(JSC::IntlCollator::compareStrings const):
(JSC::IntlCollator::checkICULocaleInvariants):
* Source/JavaScriptCore/runtime/IntlObject.cpp:
* Source/JavaScriptCore/runtime/IntlObject.h:
* Source/JavaScriptCore/runtime/IntlObjectInlines.h:
(JSC::canUseASCIIUCADUCETComparison):
(JSC::compareASCIIWithUCADUCET):

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




More information about the webkit-changes mailing list