Skip to content

Perf: Covector reuse and parallelization (20% less proving time) - #513

Open
zkfriendly wants to merge 3 commits into
mainfrom
zkfr/streamline-covectors
Open

zkfriendly wants to merge 3 commits into
mainfrom
zkfr/streamline-covectors

Conversation

@zkfriendly

Copy link
Copy Markdown
Collaborator

Covector reuse and parallelization

~20% less commitment and proving time by reusing covector evaluations and parallelizing accumulation.

On main, the single-commitment prover computes witness evaluations for the $A$, $B$, and $C$ covectors. It also computes the public-input evaluation when needed. Before WHIR, it computes these dot products again, repeating field arithmetic and reads of the same witness entries. Covector accumulation also runs sequentially.

This PR passes the existing evaluations directly to WHIR, preserving the covector order. Each claim remains $L_a(w)=\sum_i a_i,\iota(w_i)$, where $\iota$ embeds witness values into the evaluation field. Accumulation uses $u_i \leftarrow u_i+\lambda a_i$; these independent updates now run in parallel over the stored prefix. Padding stays unchanged. The proof protocol and opening claims stay unchanged.

At $2^{20}$ witness entries, commitment and proving time falls 19.3% for Goldilocks and 15.5% for BN254.

Field Witness entries Main This PR Time reduction
Goldilocks 262,144 53.424 ms 46.061 ms 13.8%
Goldilocks 1,048,576 171.802 ms 138.658 ms 19.3%
BN254 262,144 85.123 ms 73.724 ms 13.4%
BN254 1,048,576 311.281 ms 262.917 ms 15.5%

Local squaring-chain benchmarks use Apple M4 Max, eight threads, ZK commitments, and SHA-256. Each value averages three runs after one warmup. All 32 proofs verified across the main and PR runs. Timings exclude fixture generation, setup, and verification. Main and PR use separate build directories.

Main baseline: 1a16b24492fd08b3f0469a26a7da0441381e87f5.
Measured optimization: 6aee9fed14461eb28424dbbfe386a3d66677d16b; the current revision keeps the same proving code.

CSP benchmarks do not yet support Goldilocks. These results come from the manual benchmark; CI remains unchanged.

Run the benchmark:

RAYON_NUM_THREADS=8 cargo test --locked --release -p provekit-fixtures \
  --test profile field_benchmarks -- --exact --ignored --nocapture

@vercel

vercel Bot commented Oct 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs-provekit-org Ready Ready Preview Oct 20, 2026 4:33am UTC

Request Review

@zkfriendly zkfriendly changed the title Zkfr/streamline covectors Covector reuse and parallelization Oct 20, 2026
@zkfriendly zkfriendly changed the title Covector reuse and parallelization Perf: Covector reuse and parallelization (20% less proving time) Oct 20, 2026
@github-actions

Copy link
Copy Markdown

CSP benchmarks

Metric Value
Workflow status [PASS] success
Commit 6d7b596ff0ca
Run #39370192806
Circuits benchmarked 21
Iterations averaged per circuit 3

Prover time, peak RSS, peak heap, and verifier time are arithmetic means across the iterations. Peak heap comes from the largest peak memory entry in provekit-cli prove's tracing output; peak RSS is reported by /usr/bin/time -v (max-resident-set-size).

Each metric cell shows the current value followed by the percentage delta against the latest successful main run #39217449505. (new) marks circuits absent from the baseline.

Results
Circuit Constraints Witnesses Prover time Peak RSS Peak heap Verifier time Proof size PKP size
ecdsa_p256 143,321 (±0.0%) 258,215 (±0.0%) 1.46 s (-2.7%) 237 MB (-0.1%) 196 MB (±0.0%) 110 ms (±0.0%) 713 KB (+0.3%) 831 KB (±0.0%)
keccak_1024 788,814 (±0.0%) 1,490,812 (±0.0%) 4.07 s (-4.0%) 929 MB (±0.0%) 906 MB (±0.0%) 460 ms (-2.8%) 774 KB (+0.5%) 6.01 MB (±0.0%)
keccak_128 157,522 (±0.0%) 304,529 (±0.0%) 1.02 s (-3.8%) 254 MB (+1.0%) 210 MB (±0.0%) 123 ms (-5.2%) 718 KB (-3.0%) 1.24 MB (±0.0%)
keccak_2048 1,507,374 (±0.0%) 2,840,532 (±0.0%) 7.94 s (-4.0%) 1.75 GB (±0.0%) 1.74 GB (±0.0%) 860 ms (-2.3%) 869 KB (-3.8%) 12.15 MB (±0.0%)
keccak_256 247,782 (±0.0%) 474,010 (±0.0%) 1.19 s (-4.6%) 298 MB (-0.9%) 257 MB (±0.0%) 170 ms (-1.9%) 709 KB (-0.5%) 1.89 MB (±0.0%)
keccak_512 428,126 (±0.0%) 812,944 (±0.0%) 2.14 s (-3.7%) 527 MB (±0.0%) 471 MB (±0.0%) 263 ms (-2.5%) 759 KB (+0.6%) 3.25 MB (±0.0%)
poseidon2_12 479 (±0.0%) 563 (±0.0%) 40 ms (-7.6%) 13.65 MB (-0.3%) 4.17 MB (±0.0%) 10 ms (±0.0%) 225 KB (-0.6%) 437 KB (±0.0%)
poseidon2_16 556 (±0.0%) 719 (±0.0%) 40 ms (-14.3%) 14.33 MB (-0.3%) 4.33 MB (+0.1%) 10 ms (±0.0%) 228 KB (+0.7%) 530 KB (±0.0%)
poseidon2_2 231 (±0.0%) 278 (±0.0%) 33 ms (-16.8%) 12.91 MB (+0.3%) 3.44 MB (±0.0%) 10 ms (±0.0%) 228 KB (+0.3%) 108 KB (±0.0%)
poseidon2_4 529 (±0.0%) 535 (±0.0%) 30 ms (±0.0%) 13.23 MB (-0.6%) 3.63 MB (±0.0%) 10 ms (±0.0%) 226 KB (-0.8%) 31.93 KB (±0.0%)
poseidon2_8 363 (±0.0%) 423 (±0.0%) 40 ms (±0.0%) 13.47 MB (-0.3%) 4.08 MB (±0.0%) 10 ms (±0.0%) 228 KB (+0.4%) 365 KB (±0.0%)
poseidon_12 504 (±0.0%) 524 (±0.0%) 40 ms (±0.0%) 14.03 MB (-0.3%) 4.27 MB (±0.0%) 10 ms (±0.0%) 227 KB (+0.2%) 569 KB (±0.0%)
poseidon_16 609 (±0.0%) 633 (±0.0%) 50 ms (±0.0%) 14.89 MB (+0.3%) 4.93 MB (-0.1%) 10 ms (-24.8%) 227 KB (±0.0%) 717 KB (±0.0%)
poseidon_2 240 (±0.0%) 249 (±0.0%) 30 ms (-9.9%) 12.90 MB (-0.4%) 3.40 MB (±0.0%) 10 ms (±0.0%) 225 KB (-0.3%) 59.38 KB (±0.0%)
poseidon_4 297 (±0.0%) 309 (±0.0%) 40 ms (±0.0%) 13.77 MB (-0.4%) 4.02 MB (±0.0%) 10 ms (±0.0%) 226 KB (-0.2%) 333 KB (±0.0%)
poseidon_8 402 (±0.0%) 418 (±0.0%) 40 ms (±0.0%) 13.85 MB (-0.9%) 4.15 MB (±0.0%) 10 ms (±0.0%) 223 KB (-1.3%) 448 KB (±0.0%)
sha256_1024 196,913 (±0.0%) 339,721 (±0.0%) 1.11 s (-5.1%) 279 MB (+1.2%) 244 MB (±0.0%) 180 ms (-5.3%) 714 KB (-4.0%) 1.86 MB (-1.0%)
sha256_128 46,371 (±0.0%) 80,931 (±0.0%) 300 ms (-4.2%) 75.73 MB (+1.0%) 57.70 MB (±0.0%) 60 ms (±0.0%) 617 KB (+1.8%) 497 KB (-1.0%)
sha256_2048 345,372 (±0.0%) 612,681 (±0.0%) 2.13 s (-3.8%) 502 MB (±0.0%) 456 MB (±0.0%) 320 ms (-3.0%) 751 KB (-3.5%) 3.06 MB (-0.6%)
sha256_256 67,877 (±0.0%) 117,901 (±0.0%) 483 ms (-3.3%) 127 MB (±0.0%) 102 MB (±0.0%) 80 ms (±0.0%) 626 KB (±0.0%) 692 KB (-1.0%)
sha256_512 110,889 (±0.0%) 191,841 (±0.0%) 597 ms (-4.3%) 151 MB (-1.3%) 131 MB (±0.0%) 110 ms (±0.0%) 629 KB (-0.1%) 1.08 MB (-0.6%)

This branch was successfully deployed

1 active deployment
Preview — 3dd0eb38 Deployed Oct 20, 2026 by vercel[bot]
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