Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Optimization: compute_eval_table_sparse + combine_evals #1

Description

@sragss

https://github.com/a16z/Spartan2/blob/uniform_r1cs_shape/src/spartan/snark.rs#L238-L285

The compute_eval_table_sparse lambda and the following combination of the evaluations comprise ~12.5% of the end-to-end Spartan2 flow.

I see three primary performance bugs.

  • Parallelism: Currently compute_eval_table sparse is only parallel across the 3 A / B / C matrices. Most machines have more than 3 threads, thus we should increase the parallelism available.
  • Evaluation combination ordering. The combined_evals a + r * b + r * r * c can be inlined such that the values a / b / c are used directly after computation rather than storing, throwing away, and reloading from RAM.
  • r^2: During the evaluation phase should not be computed for each run of the loop. It should be computed once upfront.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions