Skip to content

Commit

Permalink
modify arkworks and decaf377 suite
Browse files Browse the repository at this point in the history
  • Loading branch information
TalDerei authored and conorsch committed Aug 15, 2024
1 parent 479dd5c commit 2dc3d54
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
24 changes: 12 additions & 12 deletions crates/bench/benches/arkworks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
})
Expand All @@ -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);
}
})
Expand All @@ -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);
}
})
Expand All @@ -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);
}
})
Expand All @@ -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)
}
})
Expand All @@ -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")
}
})
Expand All @@ -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);
}
})
Expand All @@ -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);
}
})
Expand All @@ -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);
}
})
Expand All @@ -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);
}
})
Expand All @@ -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)
}
})
Expand All @@ -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")
}
})
Expand Down
32 changes: 16 additions & 16 deletions crates/bench/benches/decaf377.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
})
Expand All @@ -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);
}
})
Expand All @@ -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);
}
})
Expand All @@ -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);
}
})
Expand All @@ -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()
}
})
Expand All @@ -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")
}
})
Expand All @@ -97,33 +97,33 @@ 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);
}
})
});
}

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);
}
})
});
}

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);
}
})
Expand All @@ -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);
}
})
Expand All @@ -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()
}
})
Expand All @@ -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")
}
})
Expand Down

0 comments on commit 2dc3d54

Please sign in to comment.