This diff speed up reading the R1CS when trying to generate proofs with bellman by using a parallel map/reduce strategy for generating the R1CS based on the lines read from the input (code inspiration: https://gist.github.com/thereal1024/8075982816643cf9d5bd5851b61b63cc).
The main steps are:
Map: each line to constraint_index => variable, coefficient, a|b|c matrix
Reduce based on constraint_index => sum all linear terms (variable * coefficient) for each matrix and return the linear combination
Create constraints A * B = C for each such linear combination
We can expect this change to speed up reading the R1CS by at least a factor of two (From 2hours to < 1 hour for 268M constraints).
Running it on 17M constraint system yielded the following results (note the time for "Done Reading"):
This diff speed up reading the R1CS when trying to generate proofs with bellman by using a parallel map/reduce strategy for generating the R1CS based on the lines read from the input (code inspiration: https://gist.github.com/thereal1024/8075982816643cf9d5bd5851b61b63cc).
The main steps are:
We can expect this change to speed up reading the R1CS by at least a factor of two (From 2hours to < 1 hour for 268M constraints). Running it on 17M constraint system yielded the following results (note the time for "Done Reading"):
Before
After