-
Notifications
You must be signed in to change notification settings - Fork 335
Open
Labels
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 = RandomStategeneric parameter to the adaptor type,where S: BuildHasher - Replace relevant calls to
HashMap::newandHashMap::defaultwith HashMap::with_hasher - Modify the adaptor type's internal constructor to consume an extra
hash_builder: Sparameter. - Add a
with_hasheradaptor toItertoolswith ahash_builder: Sparameter that's passed to the internal constructor.- The documentation for this should defer to the non-
with_hashervariant. - The documentation should include the same warning as HashMap::with_hasher
- The documentation for this should defer to the non-
- Redefine the non-
with_hasherItertoolsmethod to defer to thewith_hashervariant.
N8Brooks and Dekker1