Optimize automaton intersection when all remaining byte suffixes match. - #16564
Open
vsop-479 wants to merge 11 commits into
Open
Optimize automaton intersection when all remaining byte suffixes match.#16564vsop-479 wants to merge 11 commits into
vsop-479 wants to merge 11 commits into
Conversation
Contributor
Author
|
@mikemccand Please take a look when you get a chance. Performance on |
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.
This PR is a simplified version of #13072.
When
IntersectTermsEnumreaches an accepting automaton state that can match all remaining byte suffixes, it can stop running the automaton for the remaining bytes and enumerate terms and sub-blocks directly.This PR only computes match-all-suffix states for the simple case where an accepting state has a full-alphabet self-loop (
[0, alphabetSize - 1]). This coversPrefixQuery,TermRangeQuery, and custom binary automata.The more complex match-all-suffix states produced by
UTF32ToUTF8, such as those used byRegexpQueryandWildcardQuery, are intentionally left out of this PR and can be addressed separately.Compared with #13072, this keeps the computation simple and avoids any query-specific or UTF-8-specific handling in
RunAutomaton.