-
Notifications
You must be signed in to change notification settings - Fork 353
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
Add Nova Public Parameter benchmark for SDK #267
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use ark_crypto_primitives::sponge::poseidon::PoseidonSponge; | ||
use ark_pallas::{Fr as CF, PallasConfig as G1}; | ||
use ark_vesta::VestaConfig as G2; | ||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
use nexus_nova::{nova::sequential::PublicParams, pedersen::PedersenCommitment, poseidon_config}; | ||
|
||
mod shared; | ||
use shared::NonTrivialTestCircuit; | ||
|
||
type C1 = PedersenCommitment<ark_pallas::Projective>; | ||
type C2 = PedersenCommitment<ark_vesta::Projective>; | ||
|
||
fn nova_public_parameter_generation() { | ||
let step_circuit = NonTrivialTestCircuit::new(0); | ||
PublicParams::<G1, G2, C1, C2, PoseidonSponge<CF>, NonTrivialTestCircuit<CF>>::setup( | ||
poseidon_config(), | ||
&step_circuit, | ||
&(), | ||
&(), | ||
) | ||
.unwrap(); | ||
} | ||
|
||
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); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ use ark_relations::r1cs::{ConstraintSystemRef, SynthesisError}; | |
use nexus_nova::StepCircuit; | ||
use std::marker::PhantomData; | ||
|
||
#[allow(dead_code)] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shouldn't be dead code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is a shared code, it is used in other benches, however I don't use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True I guess it is dead for that individual build... I mean it's all test code so I guess that's fine... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. coincidently, the value of NUM_WARMUP_STEPS is 10, the minimum I need in criterion sample size is 10, I can plug in this value in my code and get rid of the |
||
pub const NUM_WARMUP_STEPS: usize = 10; | ||
|
||
pub struct NonTrivialTestCircuit<F> { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not also benchmark the provers themselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. I tried, criterion need 10 samples at least, one prover run on CI takes 4-6 minutes, which lead to at least 40 to 60 minutes to benchmark Prover.
I have plan to move all CI tasks, including benchmark prover to self-host Github Action in near future.