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

feat: passes copy_cycles by const reference to avoid copying #8051

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ template <typename Flavor, bool generalized>
PermutationMapping<Flavor::NUM_WIRES, generalized> compute_permutation_mapping(
const typename Flavor::CircuitBuilder& circuit_constructor,
typename Flavor::ProvingKey* proving_key,
std::vector<CyclicPermutation> wire_copy_cycles)
const std::vector<CyclicPermutation>& wire_copy_cycles)
{

// Initialize the table of permutations so that every element points to itself
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Re: line +112]

This should probably be a const auto& now (the compiler will infer it though)

See this comment inline on Graphite.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Re: line +118]

Here you are making another copy. If you do

const cycle_node& next_cycle_node you can avoid it.

See this comment inline on Graphite.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, wonder if this was maybe a reason I was seeing slower timing

Expand Down Expand Up @@ -368,7 +368,7 @@ inline std::tuple<LegacyPolynomial<FF>, LegacyPolynomial<FF>> compute_first_and_
template <typename Flavor>
void compute_permutation_argument_polynomials(const typename Flavor::CircuitBuilder& circuit,
typename Flavor::ProvingKey* key,
std::vector<CyclicPermutation> copy_cycles)
const std::vector<CyclicPermutation>& copy_cycles)
{
constexpr bool generalized = IsUltraPlonkFlavor<Flavor> || IsUltraFlavor<Flavor>;
auto mapping = compute_permutation_mapping<Flavor, generalized>(circuit, key, copy_cycles);
Expand Down
Loading