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

Optimise tree sitter usage #31

Merged
merged 4 commits into from
Sep 15, 2024
Merged

Optimise tree sitter usage #31

merged 4 commits into from
Sep 15, 2024

Conversation

LiamPattinson
Copy link
Collaborator

Resolves #26

Results in a massive speed up. Running on the GS2 src directory, it used to take about 5.5 seconds on my laptop, but now takes under 0.5s.

The method to achieve this isn't great, as now every rule needs to declare 'entrypoints' that must match its method type. The process of generating a map from entrypoints to (rule_code, rule) is a little messy too. It would be better to use some fancy macros, enums and match statements instead, but the current methods work well enough.

This was fixed by switching from children() to named_children()
It'll make it easier to iterate over rules later
@LiamPattinson LiamPattinson merged commit 96dd400 into main Sep 15, 2024
22 checks passed
@ZedThree ZedThree deleted the optimise_tree_sitter 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.

tree-sitter based rules are deployed sub-optimally
1 participant