rust-lang / rust-lang/hashbrown
Support lower maximum size
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3k
- Forks
- 358
- Avg merge
- 11h 57m
- Merged PRs (30d)
- 2
Description
HashMap, HashSet and HashTable are currently all 32 bytes.
Would you consider supporting a lower maximum size? For many use cases, a size limit of ~4 billion items is sufficient, so using u32 for items, bucket_mask and growth_left would suffice. This would reduce the size of the types to 24 bytes.
This may not seem a significant gain, but when using a great number of HashMaps, with a large proportion of them empty and unallocated, the overhead adds up to a significant % of total memory usage.
This could be implemented either as a feature or generic.
If you'd be willing to accept a PR for this, I'd be happy to work one up.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by locating the HashMap, HashSet, and HashTable definitions and their size-related fields, then review existing feature or generic configuration patterns. Done means supporting a lower maximum size that uses u32 for items, bucket_mask, and growth_left and reduces these types to 24 bytes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100