HarryR / ethsnarks

A toolkit for viable zk-SNARKS on Ethereum, Web, Mobile and Desktop
GNU Lesser General Public License v3.0
240 stars 57 forks source link

Avoid copy constructors to improve performance #99

Open HarryR opened 5 years ago

HarryR commented 5 years ago

There are a number of places where copy constructors are used that could significantly impact performance as the size of the circuit increases. Using constant references instead of passing by value in some specific places will help a lot.

For example, in libsnark::protoboard the following methods return values rather than references:

Making these return constant references will avoid copying a lot of data.

Making several class variables public will also solve this problem.