Closed zopsicle closed 1 year ago
A derived Hash impl would call write_u32 twice. We call write_u64 once, which is beneficial if the hasher implements write_u64 explicitly.
Example disassembly when using rustc_hash:
use rustc_hash::FxHasher; pub fn f(k: &KeyData) -> u64 { let mut h = FxHasher::default(); k.hash(&mut h); h.finish() } # before mov eax, dword ptr [rdi] movabs rcx, 5871781006564002453 imul rax, rcx rol rax, 5 mov edx, dword ptr [rdi + 4] xor rax, rdx imul rax, rcx ret # after movabs rax, 5871781006564002453 imul rax, qword ptr [rdi] ret
A derived Hash impl would call write_u32 twice. We call write_u64 once, which is beneficial if the hasher implements write_u64 explicitly.
Example disassembly when using rustc_hash: