Allow use of pre-hashed keys
- Dominant language
- Rust
- Stars
- 580
- Forks
- 50
- PR merge metrics
- No merged PRs in 30d
Description
As an optimisation, I want to be able to memoize a key-hash. My current solution is double-hashing with the first hash being key -> u64, then the second hash using a no-op hasher from u64 -> u64. However, this requires storing the hash twice in the hashmap.
I'm ok with such methods being unsafe if necessary, but the hashbrown equivalents are completely safe https://docs.rs/hashbrown/latest/hashbrown/hash_map/struct.RawEntryBuilder.html#method.from_key_hashed_nocheck
Contributor guide
No contributing guide indexed for this repository
Research direction
No file or test is named. Start by reviewing the existing map entry APIs and the linked hashbrown RawEntryBuilder::from_key_hashed_nocheck behavior; define the pre-hashed-key contract and add focused tests showing that a memoized hash works without storing it twice.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100