Open
Description
All adaptors bounded by Hash
would potentially benefit from a with_hasher
variant that allowed supplying a faster Hasher
(e.g., ahash
or fxhash
):
- duplicates
-
duplicates_with_hasher
-
- duplicates_by
-
duplicates_by_with_hasher
-
- unique
-
unique_with_hasher
-
- unique_by
-
unique_by_with_hasher
-
- all_unique
-
all_unique_with_hasher
-
- into_group_map
-
into_group_map_with_hasher
-
- into_group_map_by
-
into_group_map_by_with_hasher
-
- into_grouping_map
-
into_grouping_map_with_hasher
-
- into_grouping_map_by
-
into_grouping_map_by_with_hasher
-
- counts
-
counts_with_hasher
-
- counts_by
-
counts_by_with_hasher
-
Implementing each of these is a three step process:
- Add trailing
S = RandomState
generic parameter to the adaptor type,where S: BuildHasher
- Replace relevant calls to
HashMap::new
andHashMap::default
with HashMap::with_hasher - Modify the adaptor type's internal constructor to consume an extra
hash_builder: S
parameter. - Add a
with_hasher
adaptor toItertools
with ahash_builder: S
parameter that's passed to the internal constructor.- The documentation for this should defer to the non-
with_hasher
variant. - The documentation should include the same warning as HashMap::with_hasher
- The documentation for this should defer to the non-
- Redefine the non-
with_hasher
Itertools
method to defer to thewith_hasher
variant.