[webkit-changes] [WebKit/WebKit] 408cc4: [JSC] Add fast paths for global atom RegExp matchi...

Yijia Huang noreply at github.com
Sun Oct 13 07:48:17 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 408cc4c30591c741bb1ae14bebd1f060eb62619b
      https://github.com/WebKit/WebKit/commit/408cc4c30591c741bb1ae14bebd1f060eb62619b
  Author: Yijia Huang <yijia_huang at apple.com>
  Date:   2024-10-13 (Sun, 13 Oct 2024)

  Changed paths:
    A JSTests/microbenchmarks/global-atom-match-multi-chars.js
    A JSTests/microbenchmarks/global-atom-match-one-char.js
    A JSTests/microbenchmarks/global-atom-substring-match.js
    R JSTests/microbenchmarks/substring-match-global-atom.js
    M JSTests/stress/substring-global-atom-cache.js
    M Source/JavaScriptCore/runtime/JSGlobalObjectInlines.h
    M Source/JavaScriptCore/runtime/RegExpObject.cpp
    M Source/JavaScriptCore/runtime/RegExpObjectInlines.h
    M Source/JavaScriptCore/runtime/RegExpSubstringGlobalAtomCache.cpp
    M Source/JavaScriptCore/runtime/RegExpSubstringGlobalAtomCache.h

  Log Message:
  -----------
  [JSC] Add fast paths for global atom RegExp matching one char and multiple chars
https://bugs.webkit.org/show_bug.cgi?id=281265
rdar://137717054

Reviewed by Yusuke Suzuki.

Inspired by [1], this patch add two fast paths to let global
atom RegExp to match strings quickly with simple string search.

[1] https://chromium-review.googlesource.com/c/v8/v8/+/5872644

                                         before                    after

global-atom-substring-match          2.2508+-0.0145     ^      1.6873+-0.0077        ^ definitely 1.3340x faster
global-atom-match-multi-chars        2.4767+-0.0195     ^      1.5488+-0.0071        ^ definitely 1.5991x faster
global-atom-match-one-char           8.0799+-0.0309     ^      1.2977+-0.0078        ^ definitely 6.2264x faster

* JSTests/microbenchmarks/global-atom-match-multi-chars.js: Copied from JSTests/microbenchmarks/substring-match-global-atom.js.
(test):
* JSTests/microbenchmarks/global-atom-match-one-char.js: Copied from JSTests/microbenchmarks/substring-match-global-atom.js.
(test):
* JSTests/microbenchmarks/global-atom-substring-match.js: Renamed from JSTests/microbenchmarks/substring-match-global-atom.js.
(test):
* JSTests/stress/string-16bit-repeat-overflow.js:
* JSTests/stress/substring-global-atom-cache.js:
(test):
* Source/JavaScriptCore/runtime/RegExpObject.cpp:
(JSC::RegExpObject::matchGlobal):
* Source/JavaScriptCore/runtime/RegExpObjectInlines.h:
(JSC::GlobalAtomMeta::isSubstring):
(JSC::oneCharMatches):
(JSC::genericMatches):
(JSC::collectGlobalAtomMatches):
* Source/JavaScriptCore/runtime/RegExpSubstringGlobalAtomCache.cpp:
(JSC::RegExpSubstringGlobalAtomCache::tryGet):
(JSC::RegExpSubstringGlobalAtomCache::tryRecord):
(JSC::RegExpSubstringGlobalAtomCache::hasValidPattern): Deleted.
(JSC::RegExpSubstringGlobalAtomCache::collectMatches): Deleted.
* Source/JavaScriptCore/runtime/RegExpSubstringGlobalAtomCache.h:

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



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


More information about the webkit-changes mailing list