Skip to content

Skip repeated Sinsemilla q_0 sort work - #467

Merged
ValarDragon merged 1 commit into
mainfrom
agent/sinsemilla-q0-sort-20260919
Sep 19, 2026
Merged

ValarDragon merged 1 commit into
mainfrom
agent/sinsemilla-q0-sort-20260919

Conversation

@ValarDragon

Copy link
Copy Markdown
Contributor

Result

The focused serial Sinsemilla table-sort kernel improved portably:

  • Apple M4: -24.25 us.
  • Six-worker x86-64 Linux with 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_0 run, constructs and sorts Pasta keys for the residual values, and
inserts 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 the
unchanged generic sort. Declined specialization leaves both input buffers
untouched.

Validation

  • cargo +1.97.1 test -p zakura-halo2-proofs --lib
    • 279 passed.
  • cargo +1.97.1 test -p zakura-halo2-proofs --lib \ plonk::lookup::prover::tests
    • 22 passed.
  • cargo +1.97.1 test -p zakura-halo2-proofs --no-default-features --lib \ repeated_value_pasta_sort_matches_generic_sort_and_fallback
    • Passed for both Pasta fields; the build emitted only pre-existing
      no-default-feature warnings.
  • cargo +1.97.1 fmt --all -- --check

The 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.

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
ValarDragon force-pushed the agent/sinsemilla-q0-sort-20260919 branch from 3ca5823 to fac0e93 Compare September 19, 2026 17:40
@ValarDragon
ValarDragon marked this pull request as ready for review September 19, 2026 17:46
@v12-auditor

v12-auditor Bot commented Sep 19, 2026

Copy link
Copy Markdown

Note

Complete: Audit complete. V12 did not find any issues that need review.

Open the full results here.

Analyzed one file, diff 331dbd7...fac0e93.

@ValarDragon
ValarDragon merged commit 2e4e856 into main Sep 19, 2026
55 checks passed
@ValarDragon
ValarDragon deleted the agent/sinsemilla-q0-sort-20260919 branch September 19, 2026 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant