Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide with_hasher alternative adaptors #998

Open
11 tasks
jswrenn opened this issue Nov 19, 2024 · 0 comments · May be fixed by #1007
Open
11 tasks

Provide with_hasher alternative adaptors #998

jswrenn opened this issue Nov 19, 2024 · 0 comments · May be fixed by #1007

Comments

@jswrenn
Copy link
Member

jswrenn commented Nov 19, 2024

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant