From 77e65c96e43c48844a818ace07f009115675516c Mon Sep 17 00:00:00 2001 From: Daniel Sanchez Date: Wed, 3 Jul 2024 12:55:05 +0200 Subject: [PATCH] Added const sizes to encoder bench (#671) --- nomos-da/kzgrs-backend/benches/encoder.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nomos-da/kzgrs-backend/benches/encoder.rs b/nomos-da/kzgrs-backend/benches/encoder.rs index e74aa6be..b66a7d26 100644 --- a/nomos-da/kzgrs-backend/benches/encoder.rs +++ b/nomos-da/kzgrs-backend/benches/encoder.rs @@ -8,21 +8,21 @@ fn main() { divan::main() } -const MB1: usize = 1024 * 1024; +const MB: usize = 1024; pub fn rand_data(elements_count: usize) -> Vec { let mut buff = vec![0; elements_count * DaEncoderParams::MAX_BLS12_381_ENCODING_CHUNK_SIZE]; rand::thread_rng().fill_bytes(&mut buff); buff } -#[divan::bench(args = [128, 256, 512, 1024, 2048, 4096], sample_count = 1, sample_size = 1)] -fn encode(bencher: Bencher, column_size: usize) { +#[divan::bench(consts = [32, 64, 128, 256, 512, 1024], args = [128, 256, 512, 1024, 2048, 4096], sample_count = 1, sample_size = 1)] +fn encode(bencher: Bencher, column_size: usize) { bencher .with_inputs(|| { let params = DaEncoderParams::new(column_size, true); ( DaEncoder::new(params), - rand_data(MB1 / DaEncoderParams::MAX_BLS12_381_ENCODING_CHUNK_SIZE), + rand_data(SIZE * MB / DaEncoderParams::MAX_BLS12_381_ENCODING_CHUNK_SIZE), ) }) .input_counter(|(_, buff)| BytesCount::new(buff.len()))