-
-
Notifications
You must be signed in to change notification settings - Fork 722
feat(allocator): add HashSet
#14212
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
feat(allocator): add HashSet
#14212
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Instrumentation Performance ReportMerging #14212 will not alter performanceComparing Summary
|
HashMap::from_iter_inHashSet
overlookmotel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the implementations of the various methods copied from hashbrown?
b32ba2a to
feeba46
Compare
6065c44 to
1767176
Compare
Probably it was. The AI generated the code as a wrapper around |
feeba46 to
d50d949
Compare
d50d949 to
2799748
Compare
95be81c to
7a1c339
Compare
2799748 to
b09cd7d
Compare
b09cd7d to
8376ab7
Compare
8376ab7 to
994240b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new arena-allocated HashSet type to the oxc_allocator crate, matching the existing HashMap implementation. The HashSet is designed to work with the arena allocator and prevents Drop types from being stored to avoid memory leaks.
- Implements
HashSetas a thin wrapper aroundhashbrown::HashSetwith disabledDrop - Adds comprehensive API including constructors, iterators, and trait implementations
- Establishes conversion between
HashMap<T, ()>andHashSet<T>
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| crates/oxc_allocator/src/lib.rs | Adds module declaration and public export for the new HashSet type |
| crates/oxc_allocator/src/hash_set.rs | Complete implementation of arena-allocated HashSet with safety checks and API methods |
| crates/oxc_allocator/src/hash_map.rs | Makes HashMap's inner field public(crate) and removes commented conversion code |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
994240b to
a13a16b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this (and for including the oddity of allocator method).
To save time, in place of review, I've pushed a few commits with suggested changes (all minor). @sapphi-red If you're happy with them, please go ahead and merge, or feel free to make further changes if you don't like them.
Merge activity
|
a13a16b to
f37b211
Compare

Adds the arena-allocated
HashSet.