Repository navigation
[JSC] Optimize DFG String#indexOf with dynamic one-character search string - #80416
Merged
Conversation
Collaborator
|
EWS run on previous version of this PR (hash e67ba1c) Details |
sosukesuzuki
force-pushed
the
eng/JSC-Search-for-the-character-directly-in-DFG-String-indexOf-when-the-search-string-has-one-character-at-run-time
branch
from
November 11, 2026 01:20
e67ba1c to
510cd77
Compare
Collaborator
|
EWS run on previous version of this PR (hash 510cd77) Details |
String#indexOf when the search string has one character at run timeString#indexOf with dynamic one-character search string
sosukesuzuki
marked this pull request as ready for review
November 11, 2026 03:45
This was referenced Nov 12, 2026
Constellation
approved these changes
Nov 14, 2026
|
|
||
| VM& vm = globalObject->vm(); | ||
| CallFrame* callFrame = DECLARE_CALL_FRAME(vm); | ||
| JITOperationPrologueCallFrameTracer tracer(vm, callFrame); |
Member
There was a problem hiding this comment.
Does this matter so much in perf? If not, it is preferable to be placed after this to follow to the basic structure of the operation.
|
|
||
| VM& vm = globalObject->vm(); | ||
| CallFrame* callFrame = DECLARE_CALL_FRAME(vm); | ||
| JITOperationPrologueCallFrameTracer tracer(vm, callFrame); |
sosukesuzuki
force-pushed
the
eng/JSC-Search-for-the-character-directly-in-DFG-String-indexOf-when-the-search-string-has-one-character-at-run-time
branch
from
November 15, 2026 03:40
510cd77 to
63efb93
Compare
Collaborator
|
EWS run on current version of this PR (hash 63efb93) Details |
… string https://bugs.webkit.org/show_bug.cgi?id=331036 Reviewed by Yusuke Suzuki. operationStringIndexOf and operationStringIndexOfWithIndex are used when the search string is not a constant. They build an AdaptiveStringSearcher even when the search string has only one character, unless the base string is a long rope, where they first try a one-character search. If the search string has one character and both strings are resolved, this patch searches for that character directly. This path cannot allocate, GC, or throw. Other searches pay for the added checks. Baseline Patched string-index-of-dynamic-one-character 29.36ms 17.99ms 1.63x faster string-index-of-dynamic-two-characters 29.56ms 29.91ms 1.01x slower Tests: JSTests/microbenchmarks/string-index-of-dynamic-one-character.js JSTests/microbenchmarks/string-index-of-dynamic-two-characters.js JSTests/stress/string-index-of-dynamic-one-character.js * JSTests/microbenchmarks/string-index-of-dynamic-one-character.js: Added. (indexOf): (indexOfFrom): * JSTests/microbenchmarks/string-index-of-dynamic-two-characters.js: Added. (indexOf): (indexOfFrom): * JSTests/stress/string-index-of-dynamic-one-character.js: Added. (shouldBe): (indexOfFrom): (expectedIndexOf): (flat): (ropeSubstring): (wide): * Source/JavaScriptCore/dfg/DFGOperations.cpp: (JSC::DFG::tryStringIndexOfOneCharWithoutGC): (JSC::DFG::JSC_DEFINE_JIT_OPERATION): Canonical link: https://commits.webkit.org/326839@main
webkit-commit-queue
force-pushed
the
eng/JSC-Search-for-the-character-directly-in-DFG-String-indexOf-when-the-search-string-has-one-character-at-run-time
branch
from
November 16, 2026 01:09
63efb93 to
ff1c34e
Compare
Collaborator
|
Committed 326839@main (ff1c34e): https://commits.webkit.org/326839@main Reviewed commits have been landed. Closing PR #80416 and removing active labels. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ff1c34e
63efb93
🧪 mac-intel-wk2