diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 556838ad..c068e531 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,3 +90,12 @@ 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: | + cargo bench --bench nova_public_parameter_generation + diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 99f52f5e..fc42b3f5 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -12,7 +12,11 @@ categories = { workspace = true } [dependencies] serde.workspace = true -nexus-core = { path = "../core", features = ["prover_nova", "prover_jolt", "prover_hypernova"] } +nexus-core = { path = "../core", features = [ + "prover_nova", + "prover_jolt", + "prover_hypernova", +] } nexus-macro = { path = "../macro" } postcard = { version = "1.0.8", features = ["alloc"] } uuid = { version = "1.9.1", features = ["v4", "fast-rng"] } @@ -20,6 +24,12 @@ thiserror = "1.0.61" [dev-dependencies] nexus-profiler = { path = "../macro/profiler" } +iai-callgrind = "0.12.2" [lib] doctest = false + +[[bench]] +name = "nova_public_parameter_generation" +harness = false + diff --git a/sdk/benches/nova_public_parameter_generation.rs b/sdk/benches/nova_public_parameter_generation.rs new file mode 100644 index 00000000..4ef15d0c --- /dev/null +++ b/sdk/benches/nova_public_parameter_generation.rs @@ -0,0 +1,19 @@ +use iai_callgrind::{library_benchmark, library_benchmark_group, main}; +use nexus_sdk::nova; +use nexus_sdk::Parameters; + +fn nova_public_parameter_generation() { + nova::seq::PP::generate_for_testing().expect("Failed to generate Nova public parameters"); +} + +#[library_benchmark] +fn bench_nova_public_parameter() -> () { + nova_public_parameter_generation() +} + +library_benchmark_group!( + name = nova_public_parameter; + benchmarks = bench_nova_public_parameter +); + +main!(library_benchmark_groups = nova_public_parameter);