Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid copy constructors to improve performance #99

Open
HarryR opened this issue Dec 5, 2018 · 0 comments
Open

Avoid copy constructors to improve performance #99

HarryR opened this issue Dec 5, 2018 · 0 comments
Assignees

Comments

@HarryR
Copy link
Owner

HarryR commented Dec 5, 2018

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:

  • r1cs_variable_assignment<FieldT> full_variable_assignment() const;
  • r1cs_primary_input<FieldT> primary_input() const;
  • r1cs_auxiliary_input<FieldT> auxiliary_input() const;
  • r1cs_constraint_system<FieldT> get_constraint_system() const;

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

Making several class variables public will also solve this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant