Repository navigation
refactor(core): cache compiled wildcard RegExp per pattern - #63452
Closed
delaysystem wants to merge 2 commits into
Closed
delaysystem wants to merge 2 commits into
delaysystem wants to merge 2 commits into
Conversation
The highlights query floated on main while the wasm parser is pinned to 0.7.1. The main query references nodes the old grammar does not know, so it fails to compile and swift renders plain. Pin the query to 0.7.1 and assert the query URL tracks the pinned wasm version.
Cache compiled expressions in a capped (1000-entry FIFO) map keyed by raw pattern, with flags hoisted. Adds tests.
Contributor
|
Thanks for looking into the If you think something is missing there, such as a case your tests cover, please review or comment on #55322. Also, this branch includes the Swift highlights pin commit ( |
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.
Issue for this PR
N/A — small performance refactor, no behavior change.
Type of change
What does this PR do?
Wildcard.matchrecompiled its RegExp from the pattern on every call, and compiling dominates the cost of a match. Since callers reuse a small set of patterns, this caches the compiled expression per pattern in a capped (1000-entry, FIFO) map, with the platform flags hoisted out of the hot path. Matching semantics are unchanged.How did you verify your code works?
Ran the focused suite in
packages/core:Includes the new tests for metacharacter escaping, trailing
*handling, and repeat-call consistency.Checklist