revm
revm copied to clipboard
Use a faster hash for the state diff map
The default hasher is pretty slow for HashMaps. We should consider using something like https://docs.rs/seahash/latest/seahash/
Found this: https://gist.github.com/daboross/976978d8200caf86e02acb6805961195?permalink_comment_id=4205660#gistcomment-4205660
@rakita yep, it seems faster than seahash according to that benchmark which also has several even better candidates https://github.com/rurban/smhasher
both are non-cryptographic and should be ok for some of the revm usecases
@rakita yep, it seems faster than seahash according to that benchmark which also has several even better candidates https://github.com/rurban/smhasher
both are non-cryptographic and should be ok for some of the revm usecases
Should be okaу for all revm usecases, it is just i didnt spend time changing it 😅
Good link, thank you for sharing
TIL that hashbrown already uses ahash by default, and revm uses hashbrown for all performance-critical things 🙂
/// Default hasher for `HashMap`.
#[cfg(feature = "ahash")]
pub type DefaultHashBuilder = ahash::RandomState;
source: https://github.com/rust-lang/hashbrown/blob/1d2c1a81d1b53285decbd64410a21a90112613d7/src/map.rs#L11-L13
hashbrown it is :)