ReadWriteMemory::get_polys_r1cs() is extremely slow (here) because it clones all of the underlying not once but twice. On a ~16M cycle count trace on a 64 core machine it takes 2% of end-to-end time.
First: remove the double clones from self.v_read and self.v_write_rd. Double clones come from a clone in DensePolynomial::evals() then another in .flat_map(...).collect().
Second: refactor get_polys_r1cs() to return lifetimed references to the underlying vectors via DensePolynomial::evals_ref() rather than cloning / reallocating at all.
It may be helpful to review the tracing strategy for performance testing.
ReadWriteMemory::get_polys_r1cs()
is extremely slow (here) because it clones all of the underlying not once but twice. On a ~16M cycle count trace on a 64 core machine it takes 2% of end-to-end time.First: remove the double clones from
self.v_read
andself.v_write_rd
. Double clones come from a clone inDensePolynomial::evals()
then another in.flat_map(...).collect()
.Second: refactor
get_polys_r1cs()
to return lifetimed references to the underlying vectors viaDensePolynomial::evals_ref()
rather than cloning / reallocating at all.It may be helpful to review the tracing strategy for performance testing.