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

Only hit the RNG once per thread #65

Open
vlovich opened this issue May 13, 2024 · 1 comment
Open

Only hit the RNG once per thread #65

vlovich opened this issue May 13, 2024 · 1 comment

Comments

@vlovich
Copy link

vlovich commented May 13, 2024

It looks like GxBuildHasher accesses the Rng on every construction. Can the technique from RandomState be used instead which only does the RNG once per thread & then simply adds 1 to the state used on each construction?

@ogxd
Copy link
Owner

ogxd commented May 14, 2024

Indeed, that would probably increase performance in scenarios where a BuildHasher is created for hashing only a few bytes. This RandomState w/ increment is interesting (and battle-tested since it's in the std), let's explore this.

First we might want to setup a benchmark to have a sense of the rng overhead relative to the hashing process and to get some before/after numbers.

@ogxd ogxd added this to the GxHash 4 milestone Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants