Skip to content

Lazy-compile matcher regexes behind a substring prefilter - #3

Merged
simoncorry merged 1 commit into
mainfrom
matcher-lazy-compile
Jul 31, 2026
Merged

Lazy-compile matcher regexes behind a substring prefilter#3
simoncorry merged 1 commit into
mainfrom
matcher-lazy-compile

Conversation

@simoncorry

Copy link
Copy Markdown
Owner

Summary

  • Boundary regexes with Unicode property escapes construct lazily, and matching prefilters with a lowercase substring check. Same semantics (a boundary match is always a substring match); measured startup cost drops ~40ms for a 140-entry consumer.

Test plan

  • npm run check green (all matcher fixtures unchanged and passing)

…g prefilter

Unicode-property boundary regexes are expensive to construct (~0.3ms
each; a 140-entry consumer paid ~40ms of pure startup). Each entry now
compiles on first use, and matching prefilters with a cheap lowercase
substring check; the regex only confirms or rejects those few
candidates. A boundary match is always also a substring match, so the
semantics are byte-for-byte the same — the existing fixtures pin that.
@simoncorry
simoncorry merged commit b95f72c into main Jul 31, 2026
@simoncorry
simoncorry deleted the matcher-lazy-compile branch July 31, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant