Skip to content

Commit 7b3a60e

Browse files
committed
ed448-goldilocks: clean up benchmarks
1 parent e25ccd1 commit 7b3a60e

File tree

1 file changed

+9
-55
lines changed

1 file changed

+9
-55
lines changed

ed448-goldilocks/benches/bench.rs

Lines changed: 9 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use criterion::{BatchSize, Criterion, criterion_group, criterion_main};
22
use ed448_goldilocks::{
3-
CompressedDecaf, CompressedEdwardsY, Decaf448, DecafPoint, DecafScalar, EdwardsPoint,
4-
EdwardsScalar, MontgomeryPoint,
3+
Decaf448, DecafPoint, DecafScalar, EdwardsPoint, EdwardsScalar, MontgomeryPoint,
54
};
65
use elliptic_curve::group::GroupEncoding;
76
use elliptic_curve::{Field, Group};
@@ -36,18 +35,6 @@ pub fn ed448(c: &mut Criterion) {
3635
)
3736
});
3837

39-
group.bench_function("hash_to_curve", |b| {
40-
b.iter_batched(
41-
|| {
42-
let mut msg = [0; 64];
43-
OsRng.try_fill_bytes(&mut msg).unwrap();
44-
msg
45-
},
46-
|msg| EdwardsPoint::hash_with_defaults(&msg),
47-
BatchSize::SmallInput,
48-
)
49-
});
50-
5138
group.bench_function("encode_to_curve", |b| {
5239
b.iter_batched(
5340
|| {
@@ -60,22 +47,6 @@ pub fn ed448(c: &mut Criterion) {
6047
)
6148
});
6249

63-
group.bench_function("compress", |b| {
64-
b.iter_batched(
65-
|| EdwardsPoint::try_from_rng(&mut OsRng).unwrap(),
66-
|point| point.to_bytes().0,
67-
BatchSize::SmallInput,
68-
)
69-
});
70-
71-
group.bench_function("decompress", |b| {
72-
b.iter_batched(
73-
|| EdwardsPoint::try_from_rng(&mut OsRng).unwrap().to_bytes().0,
74-
|bytes| CompressedEdwardsY(bytes).decompress().unwrap(),
75-
BatchSize::SmallInput,
76-
)
77-
});
78-
7950
group.finish();
8051
}
8152

@@ -106,23 +77,6 @@ pub fn decaf448(c: &mut Criterion) {
10677
)
10778
});
10879

109-
group.bench_function("hash_to_curve", |b| {
110-
b.iter_batched(
111-
|| {
112-
let mut msg = [0; 64];
113-
OsRng.try_fill_bytes(&mut msg).unwrap();
114-
msg
115-
},
116-
|msg| {
117-
Decaf448::hash_from_bytes::<ExpandMsgXof<Shake256>>(
118-
&[&msg],
119-
&[b"decaf448_XOF:SHAKE256_D448MAP_RO_"],
120-
)
121-
},
122-
BatchSize::SmallInput,
123-
)
124-
});
125-
12680
group.bench_function("encode_to_curve", |b| {
12781
b.iter_batched(
12882
|| {
@@ -140,27 +94,27 @@ pub fn decaf448(c: &mut Criterion) {
14094
)
14195
});
14296

143-
group.bench_function("compress", |b| {
97+
group.bench_function("encode", |b| {
14498
b.iter_batched(
14599
|| DecafPoint::try_from_rng(&mut OsRng).unwrap(),
146-
|point| point.compress().0,
100+
|point| point.to_bytes(),
147101
BatchSize::SmallInput,
148102
)
149103
});
150104

151-
group.bench_function("decompress", |b| {
105+
group.bench_function("decode", |b| {
152106
b.iter_batched(
153-
|| DecafPoint::try_from_rng(&mut OsRng).unwrap().compress().0,
154-
|bytes| CompressedDecaf(bytes).decompress().unwrap(),
107+
|| DecafPoint::try_from_rng(&mut OsRng).unwrap().to_bytes(),
108+
|bytes| DecafPoint::from_bytes(&bytes).unwrap(),
155109
BatchSize::SmallInput,
156110
)
157111
});
158112

159113
group.finish();
160114
}
161115

162-
pub fn curve448(c: &mut Criterion) {
163-
let mut group = c.benchmark_group("Curve448");
116+
pub fn x448(c: &mut Criterion) {
117+
let mut group = c.benchmark_group("X448");
164118

165119
group.bench_function("scalar multiplication", |b| {
166120
b.iter_batched(
@@ -178,5 +132,5 @@ pub fn curve448(c: &mut Criterion) {
178132
group.finish();
179133
}
180134

181-
criterion_group!(benches, ed448, decaf448, curve448);
135+
criterion_group!(benches, ed448, decaf448, x448);
182136
criterion_main!(benches);

0 commit comments

Comments
 (0)