Repository navigation
Perf improvements for splitSepByOneOf - #3266
Merged
Merged
Conversation
Keep each pattern group in a record with strict fields instead of a lazy tuple, so the per-element loop does not load and test boxed fields. For one element patterns of size 1, 2 or 4 bytes the hash is the element itself, so a hash match is a pattern match and the byte comparison is skipped.
The group of the longest patterns always exists, keep its rolling hash in the Fill and Loop states instead of the hash array, and check it before the other groups. With a single pattern length there are no other groups to walk. Store the pattern hashes in a strict record so that comparing a hash does not load a tuple and a boxed Word32. On the CrossModule benchmarks this is 14-23% faster.
harendra-kumar
force-pushed
the
splitSepByOneOf-perf
branch
from
October 20, 2026 23:50
f842183 to
ddc9afd
Compare
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.
A packed-word path like the one in splitSepBySeq_ was also tried. It made the single-pattern cases as fast as splitSepBySeq_, but made multi-pattern sets slower and grew the state machine a lot, so it was left out.