Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use lazy-regex crate instead of plain regex #27

Merged
merged 1 commit into from
Sep 13, 2024
Merged

Conversation

LiamPattinson
Copy link
Collaborator

Currently, the tree-sitter based rules start at the root node of a file and scan the whole tree to find any matches. They then sometimes use regex to inspect what they find further. Any regular expressions used are therefore compiled once per file.

Inverting the order of operations as suggested by #26 would mean having to compile a regular expression at each node, which would be terrible for performance.

This PR pre-emptively solves this problem by replacing all instances of the plain Regex crate with lazy-regex, which provides similar capabilities but compiles only once per run.

@LiamPattinson LiamPattinson merged commit 04a7d03 into main Sep 13, 2024
22 checks passed
@ZedThree ZedThree deleted the use_lazy_regex branch November 14, 2024 14:22
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