Commit 2cea56a
committed
[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@main1 parent 0a9ad7d commit 2cea56a
5 files changed
Lines changed: 876 additions & 29 deletions
File tree
- JSTests
- microbenchmarks
- stress
- Source/JavaScriptCore/yarr
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
0 commit comments