Repository navigation
bench(precompile): measure the blake2 portable compression path - #3848
Merged
Merged
Conversation
The blake2 benches call `run`, which reaches the compression function
through `compress`. On x86 that detects AVX2 at runtime and returns
before the portable implementation, so on the x86_64 CI runner the
`blake2/*_rounds` benches only ever time the AVX2 code. The portable
one is what `no_std`, zkVM and non-x86 targets actually execute, and it
is currently unmeasured everywhere except on hosts with no SIMD path.
Add `blake2 portable/{2,10,12,64}_rounds`, calling the portable function
directly so it is timed on every host regardless of what the dispatcher
would pick. The round counts cover how SIGMA's period-10 schedule tiles:
2 is a partial tile, 10 exactly one, 12 one plus a remainder (standard
BLAKE2b), 64 several.
Reaching it needs `compress_portable`, a `#[doc(hidden)]` wrapper. The
dispatcher is the only supported entry point, so the wrapper documents
that it is not public API and exists for measurement.
Existing benchmark names are left untouched so their history carries over.
Merging this PR will improve performance by 4.57%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | blake2/2_rounds |
3.3 µs | 3.2 µs | +4.57% |
| 🆕 | Simulation | blake2 portable/10_rounds |
N/A | 2.1 µs | N/A |
| 🆕 | Simulation | blake2 portable/12_rounds |
N/A | 2.2 µs | N/A |
| 🆕 | Simulation | blake2 portable/2_rounds |
N/A | 1.4 µs | N/A |
| 🆕 | Simulation | blake2 portable/64_rounds |
N/A | 6.4 µs | N/A |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing 4waan:bench/blake2-portable (286f3d6) with main (61e0a9f)
Footnotes
-
1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports. ↩
Member
|
ack |
30 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The blake2 benches call
run, which reaches the compression function throughcompress. On x86 that detects AVX2 at runtime and returns before the portable implementation, so on the x86_64 CI runner theblake2/*_roundsbenches only ever time the AVX2 code. The portable one is whatno_std, zkVM and non-x86 targets actually execute, and it is currently unmeasured everywhere except on hosts with no SIMD path.Add
blake2 portable/{2,10,12,64}_rounds, calling the portable function directly so it is timed on every host (regardless of what the dispatcher would pick). The round counts cover how SIGMA's period-10 schedule tiles: 2 is a partial tile, 10 exactly one, 12 one plus a remainder (standard BLAKE2b), 64 several..Reaching it needs
compress_portable, a#[doc(hidden)]wrapper. The dispatcher is the only supported entry point, so the wrapper documents that it is not public API and exists for measurement.Existing benchmark names are left untouched so their histories are carried.