Bitset-based TagSet refactor: precompute tag masks and speed up hook type filtering#1665
Merged
Bitset-based TagSet refactor: precompute tag masks and speed up hook type filtering#1665
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1665 +/- ##
==========================================
+ Coverage 91.44% 91.61% +0.16%
==========================================
Files 96 96
Lines 18529 18583 +54
==========================================
+ Hits 16944 17024 +80
+ Misses 1585 1559 -26 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request refactors the TagSet implementation from a SmallVec-based dynamic collection to a fixed-size bitset representation for improved performance. The changes also introduce code generation from the Python identify package to maintain compatibility.
Changes:
- Replaced
SmallVec<[&'static str; 8]>with a fixed-size bitset array[u64; TAG_WORDS]inTagSet - Generated tag mappings and constants from Python's identify package via
gen.py - Changed hook type fields from
Vec<String>toTagSetfor direct bitset operations - Removed
smallvecdependency and addediter-without-into-iterclippy allow
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/prek-identify/src/lib.rs | Rewrote TagSet as a bitset with const constructor, iterator, and set operations (intersects, is_subset_of) |
| crates/prek-identify/src/tags.rs | Generated file containing tag constants, tag-to-ID mappings, and precomputed TagSets for interpreters/extensions/names |
| crates/prek-identify/gen.py | Added tag ID mapping logic and TagSet generation for all lookup tables |
| crates/prek/src/hook.rs | Changed types/types_or/exclude_types from Vec to TagSet with TAG_FILE default |
| crates/prek/src/cli/run/filter.rs | Updated filter logic to use TagSet bitset operations instead of iterator-based checks |
| crates/prek-identify/Cargo.toml | Removed smallvec dependency |
| Cargo.toml | Removed smallvec from workspace dependencies, allowed iter-without-into-iter lint |
| Cargo.lock | Updated lockfile to reflect dependency removal |
📦 Cargo Bloat ComparisonBinary size change: +0.00% (23.8 MiB → 23.8 MiB) Expand for cargo-bloat outputHead Branch ResultsBase Branch Results |
6d3fc68 to
3a56823
Compare
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.
No description provided.