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

fix: Improve benchmarks quality and code duplication #178

Merged
merged 9 commits into from
Dec 14, 2023

Conversation

huitseeker
Copy link
Member

@huitseeker huitseeker commented Dec 13, 2023

  • avoids uneeded code duplication in benchmarks with auxiliary functions,
  • update the circuit sizes used in Nova benchmarks to up-to-date values,
  • creates very basic circuit sizing tests for Supernova and uses them in benchmarks,

Elements to be addressed after this PR:

- Constants have been introduced to replace hard coded values previously used in the verifier circuit and number of samples.
- `bench_compressed_snark` function has been restructured, with a new `bench_compressed_snark_internal` function introduced to reduce duplication.
- Similar refactoring has also been applied to `bench_compressed_snark_with_computational_commitments`, ensuring uniformity in the code and decreasing duplication.
- The benchmark function has been updated to incorporate the use of the new constants as well as the refactored functions.
- Refactored benchmarking code in `compressed-snark-supernova.rs` for improved reuse and readability.
- Introduced the use of constants for constant values.
- Replaced hardcoded assignments with references to declared constants.
- Eliminated duplicated benchmarking codes and introduced a shared function for increased efficiency.
- Improved the benchmarking system by introducing a new function `bench_recursive_snark_internal_with_arity`, which offers code reuse.
- Replaced a hardcoded number with a constant (`NUM_CONS_VERIFIER_CITCUIT_PRIMARY`) and introduced a new constant (`NUM_SAMPLES`) for setting the benchmark group sample size,
- Refactored the functions `bench_one_augmented_circuit_recursive_snark` and `bench_two_augmented_circuit_recursive_snark` to reduce code redundancy and improve maintainability.
- Removed unnecessary assertions and error handling process with more concise `.expect` methods.
- Introduced named constants (`NUM_CONS_VERIFIER_CIRCUIT_PRIMARY` and `NUM_SAMPLES`) for an enhancement of readability and maintainability.
- Improved the benchmarking function through the replacement of hard-coded values with the newly initialized constants.
- Updated the `NUM_CONS_VERIFIER_CIRCUIT_PRIMARY` constant value in both `recursive-snark-supernova` and `compressed-snark-supernova` benchmarks for accurate evaluation.
- Enhanced the documentation for `NUM_CONS_VERIFIER_CIRCUIT_PRIMARY` with detailed comments explaining its correlation with `test_supernova_recursive_circuit_pasta` and `num_augmented_circuits`.
- Extended the `src/supernova/circuit.rs` module with a new test suite and additional functions to test supernova recursive circuits,
@huitseeker huitseeker marked this pull request as draft December 14, 2023 01:06
@huitseeker huitseeker marked this pull request as ready for review December 14, 2023 02:08
@huitseeker huitseeker force-pushed the benchmarks_upheaval branch 2 times, most recently from 43ff5d1 to b4c3e5b Compare December 14, 2023 02:59
…bench

- Updated public params sizing in `compressed-snark-supernova.rs`.
@huitseeker huitseeker added this pull request to the merge queue Dec 14, 2023
Merged via the queue into dev with commit 45f4448 Dec 14, 2023
4 checks passed
@huitseeker huitseeker deleted the benchmarks_upheaval branch December 14, 2023 13:56
huitseeker added a commit that referenced this pull request Dec 14, 2023
* fix: correct bench group typo

* refactor: Refactor snark benchmark code to remove duplication

- Constants have been introduced to replace hard coded values previously used in the verifier circuit and number of samples.
- `bench_compressed_snark` function has been restructured, with a new `bench_compressed_snark_internal` function introduced to reduce duplication.
- Similar refactoring has also been applied to `bench_compressed_snark_with_computational_commitments`, ensuring uniformity in the code and decreasing duplication.
- The benchmark function has been updated to incorporate the use of the new constants as well as the refactored functions.

* refactor: Refactor Supernova SNARK benchmarks for code reuse

- Refactored benchmarking code in `compressed-snark-supernova.rs` for improved reuse and readability.
- Introduced the use of constants for constant values.
- Replaced hardcoded assignments with references to declared constants.
- Eliminated duplicated benchmarking codes and introduced a shared function for increased efficiency.

* refactor: Refactor recursive SNARK benchmarking code

- Improved the benchmarking system by introducing a new function `bench_recursive_snark_internal_with_arity`, which offers code reuse.
- Replaced a hardcoded number with a constant (`NUM_CONS_VERIFIER_CITCUIT_PRIMARY`) and introduced a new constant (`NUM_SAMPLES`) for setting the benchmark group sample size,
- Refactored the functions `bench_one_augmented_circuit_recursive_snark` and `bench_two_augmented_circuit_recursive_snark` to reduce code redundancy and improve maintainability.
- Removed unnecessary assertions and error handling process with more concise `.expect` methods.

* refactor: Refactor constants in recursive-snark.rs

- Introduced named constants (`NUM_CONS_VERIFIER_CIRCUIT_PRIMARY` and `NUM_SAMPLES`) for an enhancement of readability and maintainability.
- Improved the benchmarking function through the replacement of hard-coded values with the newly initialized constants.

* fix: update num_cons_verifier_circuit_primary

* test: Refine supernova recursive circuit tests and benchmarks

- Updated the `NUM_CONS_VERIFIER_CIRCUIT_PRIMARY` constant value in both `recursive-snark-supernova` and `compressed-snark-supernova` benchmarks for accurate evaluation.
- Enhanced the documentation for `NUM_CONS_VERIFIER_CIRCUIT_PRIMARY` with detailed comments explaining its correlation with `test_supernova_recursive_circuit_pasta` and `num_augmented_circuits`.
- Extended the `src/supernova/circuit.rs` module with a new test suite and additional functions to test supernova recursive circuits,

* fix: also update constraint values in the loop

* refactor: Refine public parameter size hints in compressed supernova bench

- Updated public params sizing in `compressed-snark-supernova.rs`.
huitseeker added a commit that referenced this pull request Dec 14, 2023
* fix: correct bench group typo

* refactor: Refactor snark benchmark code to remove duplication

- Constants have been introduced to replace hard coded values previously used in the verifier circuit and number of samples.
- `bench_compressed_snark` function has been restructured, with a new `bench_compressed_snark_internal` function introduced to reduce duplication.
- Similar refactoring has also been applied to `bench_compressed_snark_with_computational_commitments`, ensuring uniformity in the code and decreasing duplication.
- The benchmark function has been updated to incorporate the use of the new constants as well as the refactored functions.

* refactor: Refactor Supernova SNARK benchmarks for code reuse

- Refactored benchmarking code in `compressed-snark-supernova.rs` for improved reuse and readability.
- Introduced the use of constants for constant values.
- Replaced hardcoded assignments with references to declared constants.
- Eliminated duplicated benchmarking codes and introduced a shared function for increased efficiency.

* refactor: Refactor recursive SNARK benchmarking code

- Improved the benchmarking system by introducing a new function `bench_recursive_snark_internal_with_arity`, which offers code reuse.
- Replaced a hardcoded number with a constant (`NUM_CONS_VERIFIER_CITCUIT_PRIMARY`) and introduced a new constant (`NUM_SAMPLES`) for setting the benchmark group sample size,
- Refactored the functions `bench_one_augmented_circuit_recursive_snark` and `bench_two_augmented_circuit_recursive_snark` to reduce code redundancy and improve maintainability.
- Removed unnecessary assertions and error handling process with more concise `.expect` methods.

* refactor: Refactor constants in recursive-snark.rs

- Introduced named constants (`NUM_CONS_VERIFIER_CIRCUIT_PRIMARY` and `NUM_SAMPLES`) for an enhancement of readability and maintainability.
- Improved the benchmarking function through the replacement of hard-coded values with the newly initialized constants.

* fix: update num_cons_verifier_circuit_primary

* test: Refine supernova recursive circuit tests and benchmarks

- Updated the `NUM_CONS_VERIFIER_CIRCUIT_PRIMARY` constant value in both `recursive-snark-supernova` and `compressed-snark-supernova` benchmarks for accurate evaluation.
- Enhanced the documentation for `NUM_CONS_VERIFIER_CIRCUIT_PRIMARY` with detailed comments explaining its correlation with `test_supernova_recursive_circuit_pasta` and `num_augmented_circuits`.
- Extended the `src/supernova/circuit.rs` module with a new test suite and additional functions to test supernova recursive circuits,

* fix: also update constraint values in the loop

* refactor: Refine public parameter size hints in compressed supernova bench

- Updated public params sizing in `compressed-snark-supernova.rs`.
github-actions bot pushed a commit that referenced this pull request Dec 15, 2023
* fix: correct bench group typo

* refactor: Refactor snark benchmark code to remove duplication

- Constants have been introduced to replace hard coded values previously used in the verifier circuit and number of samples.
- `bench_compressed_snark` function has been restructured, with a new `bench_compressed_snark_internal` function introduced to reduce duplication.
- Similar refactoring has also been applied to `bench_compressed_snark_with_computational_commitments`, ensuring uniformity in the code and decreasing duplication.
- The benchmark function has been updated to incorporate the use of the new constants as well as the refactored functions.

* refactor: Refactor Supernova SNARK benchmarks for code reuse

- Refactored benchmarking code in `compressed-snark-supernova.rs` for improved reuse and readability.
- Introduced the use of constants for constant values.
- Replaced hardcoded assignments with references to declared constants.
- Eliminated duplicated benchmarking codes and introduced a shared function for increased efficiency.

* refactor: Refactor recursive SNARK benchmarking code

- Improved the benchmarking system by introducing a new function `bench_recursive_snark_internal_with_arity`, which offers code reuse.
- Replaced a hardcoded number with a constant (`NUM_CONS_VERIFIER_CITCUIT_PRIMARY`) and introduced a new constant (`NUM_SAMPLES`) for setting the benchmark group sample size,
- Refactored the functions `bench_one_augmented_circuit_recursive_snark` and `bench_two_augmented_circuit_recursive_snark` to reduce code redundancy and improve maintainability.
- Removed unnecessary assertions and error handling process with more concise `.expect` methods.

* refactor: Refactor constants in recursive-snark.rs

- Introduced named constants (`NUM_CONS_VERIFIER_CIRCUIT_PRIMARY` and `NUM_SAMPLES`) for an enhancement of readability and maintainability.
- Improved the benchmarking function through the replacement of hard-coded values with the newly initialized constants.

* fix: update num_cons_verifier_circuit_primary

* test: Refine supernova recursive circuit tests and benchmarks

- Updated the `NUM_CONS_VERIFIER_CIRCUIT_PRIMARY` constant value in both `recursive-snark-supernova` and `compressed-snark-supernova` benchmarks for accurate evaluation.
- Enhanced the documentation for `NUM_CONS_VERIFIER_CIRCUIT_PRIMARY` with detailed comments explaining its correlation with `test_supernova_recursive_circuit_pasta` and `num_augmented_circuits`.
- Extended the `src/supernova/circuit.rs` module with a new test suite and additional functions to test supernova recursive circuits,

* fix: also update constraint values in the loop

* refactor: Refine public parameter size hints in compressed supernova bench

- Updated public params sizing in `compressed-snark-supernova.rs`.
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

Successfully merging this pull request may close these issues.

2 participants