-
Notifications
You must be signed in to change notification settings - Fork 82
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
Possibility of new
fns const?
#461
Comments
Follow up: Looks like |
Okay, I have found a way to do this: I've basically removed all references to
Please let me know if you're open to a PR with these changes. Looking forward to hearing from you |
It will cause a performance regression because it will call CPUID every time instead of caching the result. Try running the benchmarks on an AVX2-capable system. |
Also: is there some reason you need |
How do I do that?
I feel very daft now. What's |
Ohhh you mean |
I don't think there's any way to make it |
Let me look at this when I'm not on an M2 Mac and see if I can figure out what the performance hit would be. |
The Now that I think about it, I suppose it could impact cache hit ratios? Idk, I wouldn't want to make too many assumptions without benchmarking. Speaking of which, my PC supports AVX2. Would be happy to run benchmarks and get back to you. Just not sure how to though. |
Yeah, it's probably fine, though I do worry about painting ourselves into a corner around other potential future optimizations. |
Hmm, yes. That is a fair point. Well, I'm cool with it either way. If making |
Ideally, we need something like |
Is this something that can help us? |
While that looks very helpful for other things, it doesn't help here |
Sorry if I don't understand this correctly, but can't we use |
No, We already use it here: https://github.com/RustCrypto/password-hashes/blob/master/argon2/src/lib.rs#L459 The nice thing about that upstream change is right now any function annotated with |
Closing as "won't fix" |
Is it possible to make the
Argon2::new
andnew_with_secret
functions const? That way, we can have a constant / global static reference to the hasher and use that throughout our code.Is this something that's possible? I don't see anything that the
new
function is doing that can't be made const. It pretty much seems to be just assigning fields of the struct, and that's it.Would be happy to put a PR if required
The text was updated successfully, but these errors were encountered: