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

Cut down on rand dependency #3

Closed
alexwennerberg opened this issue Mar 19, 2022 · 4 comments
Closed

Cut down on rand dependency #3

alexwennerberg opened this issue Mar 19, 2022 · 4 comments

Comments

@alexwennerberg
Copy link

Unless I am mistaken or don't understand the RFCs, message boundaries don't need high quality RNG. I believe you can replace with https://git.alexwennerberg.com/misc/file/rand.rs.html or a simpler non-cryptographic rng library

@mdecimus
Copy link
Member

Thanks, I'll give it a try.

mdecimus added a commit that referenced this issue Mar 26, 2022
@mdecimus
Copy link
Member

Just committed this fix. Ended up using a thread local counter combined with fibonacci hashing.

@alexwennerberg
Copy link
Author

alexwennerberg commented Mar 26, 2022

awesome! one more question, whats the reason for gethostname? could that part be dropped as well?

@mdecimus
Copy link
Member

It's used to generate slightly more unique message IDs. However this could be moved as an optional dependency as the chances that two machines generate the same message Id at the same time are quite low.

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