Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2cea56a80c68a9512e6e62c528c69ebb77887ff8
      
https://github.com/WebKit/WebKit/commit/2cea56a80c68a9512e6e62c528c69ebb77887ff8
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-07-23 (Thu, 23 Jul 2026)

  Changed paths:
    A JSTests/microbenchmarks/regexp-unicode-bm-search-emoji.js
    A JSTests/microbenchmarks/regexp-unicode-bm-search-nomatch.js
    A JSTests/microbenchmarks/regexp-unicode-bm-search.js
    A JSTests/stress/regexp-unicode-bm-search.js
    M Source/JavaScriptCore/yarr/YarrJIT.cpp

  Log Message:
  -----------
  [YARR] Enable Boyer-Moore lookahead optimization for Unicode patterns
https://bugs.webkit.org/show_bug.cgi?id=307635

Reviewed by Yusuke Suzuki.

The Boyer-Moore lookahead skip optimization in Yarr JIT was disabled for
patterns with the /u or /v flags.

This change:

  1. Removes the eitherUnicode() guard from BoyerMooreInfo collection.
     The guard is kept only for the multi-pattern SIMD prefilter, which
     is untouched by this change.
  2. Adds readCharacterRaw() which reads raw UTF-16 code units in the BM
     scan loops instead of tryReadUnicodeChar(), avoiding unnecessary
     surrogate pair decoding overhead in the prefilter.
  3. Ends the BM window at a character class that can match a non-BMP
     code point (an inverted class, or one with non-BMP members), since
     such a class consumes one or two code units and makes the offsets
     of subsequent terms non-fixed (e.g. /(.A)\1/u would otherwise miss
     a match).

                                          TipOfTree                  Patched

regexp-unicode-bm-search              175.9850+-4.8277     ^     
16.2982+-0.8780        ^ definitely 10.7978x faster
regexp-unicode-bm-search-nomatch      168.9133+-1.4194     ^     
18.4031+-1.5015        ^ definitely 9.1785x faster
regexp-unicode-bm-search-emoji         77.8834+-1.1231     ^      
7.7590+-0.1699        ^ definitely 10.0378x faster

Tests: JSTests/microbenchmarks/regexp-unicode-bm-search-emoji.js
       JSTests/microbenchmarks/regexp-unicode-bm-search-nomatch.js
       JSTests/microbenchmarks/regexp-unicode-bm-search.js
       JSTests/stress/regexp-unicode-bm-search.js

* JSTests/microbenchmarks/regexp-unicode-bm-search-emoji.js: Added.
* JSTests/microbenchmarks/regexp-unicode-bm-search-nomatch.js: Added.
* JSTests/microbenchmarks/regexp-unicode-bm-search.js: Added.
* JSTests/stress/regexp-unicode-bm-search.js: Added.
(shouldBe):
(throw.new.Error):
* Source/JavaScriptCore/yarr/YarrJIT.cpp:

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



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

Reply via email to