Skip to content

Commit

Permalink
Add Nova Public Parameter benchmark for SDK
Browse files Browse the repository at this point in the history
Summary:

Test Plan:
  • Loading branch information
duc-nx committed Aug 20, 2024
1 parent 02dc248 commit 0c50e81
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,13 @@ jobs:
run: |
cargo bench --bench riscv_machine
bench-nova-public-params:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'benchmark')
steps:
- uses: actions/checkout@v4
- name: Run benchmarks
run: |
cd nova-benches/
cargo bench --bench nova_public_parameter_generation
5 changes: 5 additions & 0 deletions sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ thiserror = "1.0.61"

[dev-dependencies]
nexus-profiler = { path = "../macro/profiler" }
criterion = "0.5.1"

[lib]
doctest = false

[[bench]]
name = "nova_public_parameter_generation"
harness = false
20 changes: 20 additions & 0 deletions sdk/benches/nova_public_parameter_generation.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use criterion::{criterion_group, criterion_main, Criterion};
use nexus_sdk::{nova, Parameters};

fn nova_public_parameter_generation() {
nova::seq::PP::generate_for_testing().expect("Failed to generate Nova public parameters");
}

#[allow(clippy::redundant_closure)]
fn bench_nova_public_parameter(c: &mut Criterion) {
c.bench_function("nova_public_parameter", |b| {
b.iter(|| nova_public_parameter_generation())
});
}

criterion_group!(
name = benches;
config = Criterion::default().significance_level(0.1).sample_size(10);
targets = bench_nova_public_parameter);

criterion_main!(benches);

0 comments on commit 0c50e81

Please sign in to comment.