flurry icon indicating copy to clipboard operation
flurry copied to clipboard

Allow use of pre-hashed keys

Open conradludgate opened this issue 4 months ago • 1 comments

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

conradludgate avatar Feb 13 '24 12:02 conradludgate