perf(prover): hold R1CS and w2 layers resident; remove unused compression#438
Merged
Conversation
…sion Removes the CompressedR1CS / CompressedLayers postcard-serialization dance from prove_with_witness. The serialization was added in 9291f2b to shrink peak memory during the commit phase (~270 MB saving on complete_age_check at the time). Subsequent memory-reduction work made the sumcheck phase the dominant memory consumer; on every measured circuit today the commit-phase saving never reaches the global peak, making the (de)serialization pure overhead. Measured on 9 circuits spanning ~60 ms to 2.7 s, peak memory 9 MB to 880 MB (basic-4, poseidon2, noir_sha256, poseidon-rounds, t_attest, t_add_integrity_commit, t_add_id_data_1850, t_add_dsc_1850, complete_age_check): - peak memory unchanged on every circuit - allocations -14% to -41% on circuits using LogUp inverse builders (e.g. complete_age_check 4.25M -> 3.56M) - wall time on prove >=200ms: -3% to -9% - all proofs still verify, all 62 workspace tests pass If a future circuit shape ever makes commit-phase peak exceed sumcheck-phase peak, reintroduce a similar (de)serialization step then; git history (9291f2b) preserves the prior implementation.
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.
Summary
Removes prover-state compression (postcard serialize/deserialize of R1CS and w2 layers during the commit phase). Introduced in 9291f2b to shrink commit-phase peak by ~270 MB; subsequent memory work made sumcheck phase dominate global peak, so the saving no longer reaches it. Today it is pure overhead.
Measured impact
Median-of-5, interleaved v1 vs opt. Peak memory identical on every circuit; allocations drop deterministically on circuits using challenge-based witness builders.
Wall time trends -3% to -6% on big circuits but noisy; allocation count is the deterministic gain.
Rollback
If a future circuit makes commit-phase peak exceed sumcheck-phase peak, restore compression from 9291f2b.
Test plan
cargo test --release --workspace --exclude provekit-bench— 62 passed