From 2dc3d54d91826b0f8a135e3cf4a4da4723c82670 Mon Sep 17 00:00:00 2001 From: Tal Derei Date: Tue, 13 Aug 2024 07:47:10 -0700 Subject: [PATCH] modify arkworks and decaf377 suite --- crates/bench/benches/arkworks.rs | 24 ++++++++++++------------ crates/bench/benches/decaf377.rs | 32 ++++++++++++++++---------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/crates/bench/benches/arkworks.rs b/crates/bench/benches/arkworks.rs index ce45030e63..2b97197b13 100644 --- a/crates/bench/benches/arkworks.rs +++ b/crates/bench/benches/arkworks.rs @@ -16,7 +16,7 @@ fn bench_base_field_addition(c: &mut Criterion) { c.bench_function("arkworks:fq field addition", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) + black_box(y); } }) @@ -29,7 +29,7 @@ fn bench_base_field_subtraction(c: &mut Criterion) { c.bench_function("arkworks: fq field subtraction", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) - black_box(y); } }) @@ -42,7 +42,7 @@ fn bench_base_field_mutliplication(c: &mut Criterion) { c.bench_function("arkworks: fq field multiplication", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) * black_box(y); } }) @@ -55,7 +55,7 @@ fn bench_base_field_negation(c: &mut Criterion) { c.bench_function("arkworks: fq field negation", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) + black_box(-y); } }) @@ -66,7 +66,7 @@ fn bench_base_field_square(c: &mut Criterion) { let mut x = generate_fq_arkworks(); c.bench_function("arkworks: fq field squaring", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = Fp384::square(&x) } }) @@ -78,7 +78,7 @@ fn bench_base_field_inverse(c: &mut Criterion) { c.bench_function("arkworks: fq field inverse", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = Fp384::inverse(&x).expect("inverse") } }) @@ -98,7 +98,7 @@ fn bench_scalar_field_addition(c: &mut Criterion) { c.bench_function("arkworks: fr field addition", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) + black_box(y); } }) @@ -111,7 +111,7 @@ fn bench_scalar_field_subtraction(c: &mut Criterion) { c.bench_function("arkworks: fr field subtraction", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) - black_box(y); } }) @@ -124,7 +124,7 @@ fn bench_scalar_field_mutliplication(c: &mut Criterion) { c.bench_function("arkworks: fr field multiplication", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) * black_box(y); } }) @@ -137,7 +137,7 @@ fn bench_scalar_field_negation(c: &mut Criterion) { c.bench_function("arkworks: fr field negation", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) + black_box(-y); } }) @@ -148,7 +148,7 @@ fn bench_scalar_field_square(c: &mut Criterion) { let mut x = generate_fr_arkworks(); c.bench_function("arkworks: fr field squaring", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = Fp256::square(&x) } }) @@ -160,7 +160,7 @@ fn bench_scalar_field_inverse(c: &mut Criterion) { c.bench_function("arkworks: fr field inverse", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = Fp256::inverse(&x).expect("inverse") } }) diff --git a/crates/bench/benches/decaf377.rs b/crates/bench/benches/decaf377.rs index cccbdfe5ba..dbd9029923 100644 --- a/crates/bench/benches/decaf377.rs +++ b/crates/bench/benches/decaf377.rs @@ -14,7 +14,7 @@ fn bench_base_field_addition(c: &mut Criterion) { c.bench_function("decaf377: fp field addition", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) + black_box(y); } }) @@ -27,7 +27,7 @@ fn bench_base_field_subtraction(c: &mut Criterion) { c.bench_function("decaf377: fp field subtraction", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) - black_box(y); } }) @@ -40,7 +40,7 @@ fn bench_base_field_multiplication(c: &mut Criterion) { c.bench_function("decaf377: fp field multiplication", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) * black_box(y); } }) @@ -53,7 +53,7 @@ fn bench_base_field_negation(c: &mut Criterion) { c.bench_function("decaf377: fp field negation", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) + black_box(-y); } }) @@ -65,7 +65,7 @@ fn bench_base_field_square(c: &mut Criterion) { c.bench_function("decaf377: fp field squaring", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x).square() } }) @@ -77,7 +77,7 @@ fn bench_base_field_inverse(c: &mut Criterion) { c.bench_function("decaf377: fp field inverse", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x).inverse().expect("inverse") } }) @@ -97,7 +97,7 @@ fn bench_scalar_field_addition(c: &mut Criterion) { c.bench_function("decaf377: fq field addition", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) + black_box(y); } }) @@ -105,12 +105,12 @@ fn bench_scalar_field_addition(c: &mut Criterion) { } fn bench_scalar_field_subtraction(c: &mut Criterion) { - let mut x = generate_fp(); - let y = generate_fp(); + let mut x = generate_fq(); + let y = generate_fq(); c.bench_function("decaf377: fq field subtraction", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) - black_box(y); } }) @@ -118,12 +118,12 @@ fn bench_scalar_field_subtraction(c: &mut Criterion) { } fn bench_scalar_field_multiplication(c: &mut Criterion) { - let mut x = generate_fp(); - let y = generate_fp(); + let mut x = generate_fq(); + let y = generate_fq(); c.bench_function("decaf377: fq field multiplication", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) * black_box(y); } }) @@ -136,7 +136,7 @@ fn bench_scalar_field_negation(c: &mut Criterion) { c.bench_function("decaf377: fq field negation", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x) + black_box(-y); } }) @@ -148,7 +148,7 @@ fn bench_scalar_field_square(c: &mut Criterion) { c.bench_function("decaf377: fq field squaring", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x).square() } }) @@ -160,7 +160,7 @@ fn bench_scalar_field_inverse(c: &mut Criterion) { c.bench_function("decaf377: fq field inverse", |b| { b.iter(|| { - for _ in 0..1000 { + for _ in 0..100000 { x = black_box(x).inverse().expect("inverse") } })