Skip to content

Provide with_hasher alternative adaptors #998

Open
@jswrenn

Description

@jswrenn

All adaptors bounded by Hash would potentially benefit from a with_hasher variant that allowed supplying a faster Hasher (e.g., ahash or fxhash):

Implementing each of these is a three step process:

  1. Add trailingS = RandomState generic parameter to the adaptor type, where S: BuildHasher
  2. Replace relevant calls to HashMap::new and HashMap::default with HashMap::with_hasher
  3. Modify the adaptor type's internal constructor to consume an extra hash_builder: S parameter.
  4. Add a with_hasher adaptor to Itertools with a hash_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
  5. Redefine the non-with_hasher Itertools method to defer to the with_hasher variant.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions