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

query init only once #99

Merged
merged 2 commits into from
Jul 28, 2024
Merged

query init only once #99

merged 2 commits into from
Jul 28, 2024

Conversation

alexpovel
Copy link
Owner

  • fix(language-scoping): Construct TSQuery only once
  • chore(language-scoping): Blanket impl Scoper for all LanguageScoper

A query is static across the entire lifetime of a
run. It does not change, but it was `clone()`d on
each call to `scope_via_query`, which is
expensive. This change constructs the *actually*
required `TSQuery` only once (alongside its
"negative" counterpart, which also allows later
parts to just take a `&TSQuery` instead of `&mut
TSQuery`).

Closes #76
@alexpovel alexpovel linked an issue Jul 28, 2024 that may be closed by this pull request
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 93.75000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 85.78%. Comparing base (1700a8d) to head (faddf39).

Files Patch % Lines
src/scoping/langs/mod.rs 87.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #99      +/-   ##
==========================================
+ Coverage   85.54%   85.78%   +0.23%     
==========================================
  Files          30       30              
  Lines        1557     1562       +5     
==========================================
+ Hits         1332     1340       +8     
+ Misses        225      222       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alexpovel alexpovel merged commit 6d8554b into main Jul 28, 2024
16 checks passed
@alexpovel alexpovel deleted the query-init-only-once branch August 18, 2024 18:19
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.

Fix cloning static query on every query call
2 participants