-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Improve crypto benchmarks #6164
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the benchmarks pre-warn the cpu cache/branch predictor? I recall seeing significant differences when I was benchmarking some of this code originally.
We perform quite a lot of iterations for each measured primitive, so it shouldn't make much of a difference. But even if it does, I'd rather leave the benchmarks as-is, so that they are more representative of the expected performance in actual applications. |
Any idea of a better name for |
This is already exists in
Time is for to do it. :) |
So maybe stick to that name? Otherwise, we can rename |
Put a thumb up if we should keep |
Alright, 100% of the votes are for the latter. 😄 Renamed! |
CI failure is my fault, should be fixed in b498eeb (the good news is this was a latent bug exposed by the added safety feature introduced in 6fb105f). If you rebase and force push, it should refresh the CI run. I do want to let it run for this change to make sure the asm works on the various architectures. LLVM has bespoke inline assembly parsing for each arch. |
- 1MiB objects on the stack doesn't play well with wasmtime. Reduce these to 512KiB so that the webassembly benchmarks can run. - Pass expected results to a blackBox() function. Without this, in release-fast mode, the compiler could detected unused return values, and would produce results that didn't make sense for siphash. - Add AEAD constructions to the benchmarks. - Inline chacha20Core() makes it 4 times faster. - benchmarkSignatures() -> benchmarkSignature() for consistency.
@andrewrk all green! |
@data-man thumbupped! |
Nice work! BTW just in case you haven't seen it, we have this repo for tracking performance of various benchmarks over time: https://github.com/ziglang/gotta-go-fast/ We don't have any crypto benchmarks yet (ziglang/gotta-go-fast#5) but that would be a nice addition. We also don't have a fully featured way of exposing the data yet. @wozeparrot made some google charts that are nice in the meantime, but eventually I would like to have a whole page of ziglang.org that lets you browse all the benchmarks over time and reveal which commits happened and inspect other details. If you look at |
blackBox()
function. Without this, inrelease-fast
mode, the compiler could detected unused return values, and would produce results that didn't make sense forsiphash
.chacha20Core()
makes it 4 times faster.benchmarkSignatures()
->benchmarkSignature()
for consistency.