Repository navigation
bench: give DSA parameter generation a median tape at each size - #4301
Merged
Merged
Conversation
Each size's fixed tape was one draw of a search whose length varies: the 1024-bit one was the slowest of nine seeds, 4x the median. Take each size's tape from the seed whose refillable-tape search is the median of nine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TKUFHGhkN8REQLPW8yxN5A
alex
force-pushed
the
claude/dsa-parameters-bench-median
branch
from
November 6, 2026 10:34
cf0a3ab to
ded40c0
Compare
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.
dsa_generate_parameterstimed verified-garbage on a single fixed tape per size,fixed_tape(bits). How long a parameter search takes depends on how many seeds and candidates its tape rejects, so that number was one draw from a wide distribution, compared against OpenSSL's average over fresh draws. The 1024-bit tape was the slowest of the nine seeds below: about 4× the median.This takes each size's tape from the seed whose search is the median of seeds
bitstobits + 8: 1027, 2050 and 3075. As before, every iteration searches the same tape. This is the counterpart of RSA keygen's median tape (#4271), but ranked by search time rather than by octets drawn. The refillable-tape search usually reads its whole tape from one fill of512 · p_lenoctets, so the octets drawn don't say how long the search was.How the seeds were ranked
The best of three timings of each seed's search, on x86-64 with
VG_CPU_FEATURES=none(the baseline implementations), in a scratch program callingParameters::generate_with_rngas the benchmark does:bits…bits + 8, sorted (ms)bits)The ranking was done once, on x86-64. Since #4304 every target runs the refillable-tape search, which reads the same seeds, candidates and witnesses from a tape on all of them, and its cost is the Miller–Rabin rounds those candidates take. So the ranking holds on every target. The comment in the benchmark says so.
Benchmark
Benchmarks run 42184897360 (
arches: x86_64,modules: dsa, againstmainat7f03ff1b). Both sides run this branch's benchmark harness, so both use the new seeds. The library is unchanged, and so are the times:dsa_generate_parameters/1024dsa_generate_parameters/2048dsa_generate_parameters/3072The before/after of the tapes themselves is in the ranking table above. The branch has since been rebased onto
mainafter #4304. That rebase changed only this file's comment: the three-tape path it mentioned is gone.One file changes,
bench/benches/primitives/dsa_parameters.rs. No library code, tests or proofs change.🤖 Generated with Claude Code
https://claude.ai/code/session_01TKUFHGhkN8REQLPW8yxN5A