You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add write_* methods for DefaultHasher, SipHasher, SipHasher13, sip::Hasher.
`sip::Hasher::short_write` is currently unused. It is called by
`sip::Hasher::write_{u8,usize}`, but those methods are also unused,
because `DefaultHasher`, `SipHasher` and `SipHasher13` don't implement
any of the `write_xyz` methods, so all their write operations end up
calling `sip::Hasher::write`.
I confirmed this by inserting a `panic!` in `sip::Hasher::short_write`
and running the tests -- they all passed.
This commit adds all the `write_xyz` methods to `DefaultHasher`,
`SipHasher`, `SipHasher13` and `sip::Hasher`, which means that
`short_write` will be used for all of them.
(I haven't properly implemented 128-bit writes in `sip::Hasher` and
`SipHasher128`. That could be a follow-up if something thinks it is
important.)
Some microbenchmarks I wrote show that this commit speeds up default
hashing of integers by about 2.5x, and can speed up hash tables that use
`DefaultHasher` and have keys that contain integers by up to 30%, though
the exact amount depends heavily on the details of the keys and how the
table is used. This makes default `Hash{Map,Set}` much more likely to be
competitive with `FxHash{Map,Set}`.
0 commit comments