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

Consider reducing the size of RandomState #158

Closed
arthurprs opened this issue Jun 30, 2023 · 4 comments
Closed

Consider reducing the size of RandomState #158

arthurprs opened this issue Jun 30, 2023 · 4 comments

Comments

@arthurprs
Copy link

arthurprs commented Jun 30, 2023

Do you think it's possible to reduce the size of RandomState? Could ahash get away with only 16 bytes maybe? Right now it's 32 bytes long, which is twice as much as the std lib version.

This might seem inconsequential, but it can add significant overhead when ahash hashmaps are used inside repeated/nested structures.

@tkaitchuck
Copy link
Owner

It is a cpu tradeoff. It is possible to reduce the size to 16 bytes, but it will add additional instructions that need to be done on each hash.
Introduce a feature flag for it isn't great either because it forces the whole application into one or the other. We could have an alternate HashBuilder, but it would be manual everywhere you want to use the code.

@arthurprs
Copy link
Author

arthurprs commented Oct 24, 2023

A separated HashBuilder sounds reasonable and would work fine for such use cases 👍

@tkaitchuck
Copy link
Owner

@arthurprs Can you confirm this work: #226

@arthurprs
Copy link
Author

arthurprs commented Mar 27, 2024

Closed via #226 Thank you!

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

2 participants