Improve circuit setup phase - #74
Merged
Merged
Conversation
frozenspider
marked this pull request as ready for review
September 21, 2026 19:55
zkfriendly
approved these changes
Sep 22, 2026
zkfriendly
left a comment
Collaborator
There was a problem hiding this comment.
LGTM, I was able to reproduce the results
Collaborator
|
Noticed the CI is failing; can we address that here before merging? |
Collaborator
Author
|
@zkfriendly: this is a separate issue with our test suite being quite borked (see #63, but it's not just that). |
Merged
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.
Resolves #45, also partially implements #44
This PR makes R1CS circuit setup faster, use less peak memory and do significantly less allocation:
(Using
circuit_setupbenchmark for measurement)sha256-2kbSummary of changes:
bigint_to_fqto useLazyLockto only mapQ100(BigIntonce instead of on every invocation. Part in matrix setup: 92% -> 88%.SparseMatrix::map_values_with.BTreeMap/BTreeSetinLinearCombinationandBoolLinearCombinationwithVecthat are kept sorted and deduplicated.ConstraintGenerator::bitz_unsigned.map_values_withnow takes a function by value instead of function reference - this is a style change, performance is unaffected.Sampling with:
Final measurements done with: