Skip repeated Sinsemilla q_0 sort work - #467
Merged
Merged
Conversation
Remove the dominant nonzero q_0 run before constructing and sorting Pasta lookup keys, then insert it at its canonical sorted position. Preserve the existing one-quarter eligibility gate and generic fallback without adding allocation, retained memory, or API surface.
ValarDragon
force-pushed
the
agent/sinsemilla-q0-sort-20260919
branch
from
September 19, 2026 17:40
3ca5823 to
fac0e93
Compare
ValarDragon
marked this pull request as ready for review
September 19, 2026 17:46
|
Note Complete: Audit complete. V12 did not find any issues that need review. Open the full results here. Analyzed one file, diff |
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.
Result
The focused serial Sinsemilla table-sort kernel improved portably:
x86_64-asm: -25.09 us.The enclosing lookup-permutation phase and full-proof measurements were
noise-neutral, so this PR claims only the resolved serial-kernel improvement.
Paired proof checks produced exact proof bytes. Retained proving-key memory and
public APIs are unchanged.
Change
The Sinsemilla generator table repeats its compressed first-row value,
q_0,over roughly half of its usable rows. Table preparation now removes a dominant
nonzero
q_0run, constructs and sorts Pasta keys for the residual values, andinserts the run at its canonical sorted position.
The optimization retains the existing one-quarter eligibility threshold. An
empty input, zero
q_0, a sub-threshold run, or a non-Pasta field takes theunchanged generic sort. Declined specialization leaves both input buffers
untouched.
Validation
cargo +1.97.1 test -p zakura-halo2-proofs --libcargo +1.97.1 test -p zakura-halo2-proofs --lib \ plonk::lookup::prover::testscargo +1.97.1 test -p zakura-halo2-proofs --no-default-features --lib \ repeated_value_pasta_sort_matches_generic_sort_and_fallbackno-default-feature warnings.
cargo +1.97.1 fmt --all -- --checkThe new equivalence tests cover all-repeated inputs, the exact threshold,
below-threshold and zero-value fallback, empty input, and insertion at the
start, middle, and end of the canonical field ordering. They compare both the
sorted values and key metadata with the generic route for both Pasta fields.