Skip to content

Commit

Permalink
Merge feat/bench
Browse files Browse the repository at this point in the history
  • Loading branch information
Mason Liang committed Nov 14, 2023
1 parent a61b269 commit 818cc3d
Show file tree
Hide file tree
Showing 8 changed files with 80,396 additions and 121 deletions.
353 changes: 244 additions & 109 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ hex = "0.4"
thiserror = "1.0"
log = "0.4"
env_logger = "0.9.0"
mpt-zktrie = { git = "https://github.com/scroll-tech/zkevm-circuits.git", rev = "7d9bc181953cfc6e7baf82ff0ce651281fd70a8a" }
rand_chacha = "0.3.0"

[patch."https://github.com/privacy-scaling-explorations/halo2.git"]
halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "develop" }
Expand All @@ -34,9 +36,8 @@ print_layout = ["halo2_proofs/dev-graph"]
default = ["halo2_proofs/mock-batch-inv", "halo2_proofs/parallel_syn"]

[dev-dependencies]
mpt-zktrie = { git = "https://github.com/scroll-tech/zkevm-circuits.git", rev = "7d9bc181953cfc6e7baf82ff0ce651281fd70a8a" }
criterion = { version = "0.4", features = ["html_reports"] }
# mpt-zktrie = { path = "../scroll-circuits/zktrie" }
rand_chacha = "0.3.0"
plotters = "0.3"
bencher = "0.1"
subtle = "2"
Expand All @@ -48,3 +49,8 @@ path = "integration-tests/src/main.rs"
[profile.test]
opt-level = 3
debug-assertions = true

[[bench]]
name = "parallel_assignment"
harness = false
features = [ "test" ]
39 changes: 39 additions & 0 deletions benches/parallel_assignment.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use halo2_mpt_circuits::MPTProofType;
use halo2_mpt_circuits::{
gadgets::poseidon::PoseidonTable, serde::SMTTrace, tests::TestCircuit, MptCircuitConfig,
};
use halo2_proofs::dev::MockProver;
use halo2_proofs::halo2curves::bn256::{Bn256, Fr};
use halo2_proofs::plonk::ConstraintSystem;
use halo2_proofs::plonk::FirstPhase;

fn bench(c: &mut Criterion) {
let json = include_str!("traces.json");
let witness: Vec<(MPTProofType, SMTTrace)> = serde_json::from_str(&json).unwrap();
let circuit = TestCircuit::new(10_000, witness);

c.bench_function("assign trace", |b| {
b.iter(|| MockProver::<Fr>::run(14, &circuit, vec![]))
});
}

// fn criterion_benchmark(c: &mut Criterion) {
// let json = include_str!("traces.json");
// let trace: SMTTrace = serde_json::from_str(&json).unwrap();

// let mut cs = ConstraintSystem::default();
// let poseidon = PoseidonTable::configure(&mut cs);
// let challenge = cs.challenge_usable_after(FirstPhase);
// let mpt = MptCircuitConfig::configure(&mut cs, challenge, &poseidon);

// c.bench_function("assign trace", |b| b.iter(|| mpt.assign((black_box(20))));
// }

criterion_group! {
name = benches;
config = Criterion::default().sample_size(10);
targets = bench
}

criterion_main!(benches);
Loading

0 comments on commit 818cc3d

Please sign in to comment.