Fix kzg bench (#336)
This commit is contained in:
parent
115d45d0f0
commit
466cef7623
|
@ -1,24 +1,23 @@
|
|||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
use kzg::{types::kzg_settings::FsKZGSettings, utils::generate_trusted_setup};
|
||||
use kzg_traits::{FFTSettings, KZGSettings};
|
||||
use nomos_kzg::Blob;
|
||||
use nomos_kzg::{Blob, KzgSettings};
|
||||
|
||||
fn nomos_dynamic_vs_external(c: &mut Criterion) {
|
||||
let (g1s, g2s) = generate_trusted_setup(4096, [0; 32]);
|
||||
let fft_settings = kzg::types::fft_settings::FsFFTSettings::new(8).unwrap();
|
||||
let settings = FsKZGSettings::new(&g1s, &g2s, 4096, &fft_settings).unwrap();
|
||||
let blob = Blob::from_bytes(&[5; 4096 * 32]).unwrap();
|
||||
let kzg_settings = KzgSettings {
|
||||
settings: settings.clone(),
|
||||
bytes_per_field_element: 32,
|
||||
};
|
||||
let data = [5; 4096 * 32];
|
||||
let blob = Blob::from_bytes(&data, &kzg_settings).unwrap();
|
||||
|
||||
let mut group = c.benchmark_group("KZG Commitment Benchmarks");
|
||||
|
||||
group.bench_function("nomos blob commitment", |b| {
|
||||
b.iter(|| {
|
||||
nomos_kzg::blob_to_kzg_commitment(
|
||||
black_box(&blob),
|
||||
black_box(&settings),
|
||||
black_box(4096),
|
||||
)
|
||||
})
|
||||
b.iter(|| nomos_kzg::compute_commitment(black_box(&data), black_box(&kzg_settings)))
|
||||
});
|
||||
|
||||
group.bench_function("external blob commitment", |b| {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
mod dynamic_kzg;
|
||||
mod types;
|
||||
|
||||
use crate::types::KzgSettings;
|
||||
pub use crate::types::{Blob, Commitment, Proof};
|
||||
pub use crate::types::{Blob, Commitment, KzgSettings, Proof};
|
||||
pub use dynamic_kzg::{blob_to_kzg_commitment, compute_blob_kzg_proof, verify_blob_kzg_proof};
|
||||
use std::error::Error;
|
||||
|
||||
|
|
Loading…
Reference in New Issue