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

Hash caching and shared set hash functions #7

Open
mappum opened this issue Nov 10, 2019 · 0 comments
Open

Hash caching and shared set hash functions #7

mappum opened this issue Nov 10, 2019 · 0 comments

Comments

@mappum
Copy link
Contributor

mappum commented Nov 10, 2019

We will be storing read/write keys in sets and doing intersection/union operations on them often. Since std::collections::HashSet uses a random hash function per-instance by default to prevent DoS attacks, that means we have to hash each key a significant number of times.

It would be more efficient to create sets which share a hash function, and cache the computed hash somewhere (possibly inside the Key struct, see #8).

We can still randomize the hash function periodically to prevent DoS (e.g. once per block, with each node picking a random seed since it doesn't need to be deterministic).

This feature could live in its own crate, named hashcache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant