Skip to content

Commit fe2c70a

Browse files
committed
Reintroduce benchmark for NTT with mul + transforms
1 parent 45f775a commit fe2c70a

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

benches/ntt_multiplication.rs

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,20 @@ pub fn bench_ntt_dilithium_params_with_ntt(c: &mut Criterion) {
6363
);
6464
}
6565

66+
/// benchmark multiplication in typical dilithium parameter set with NTT & Transforms
67+
/// `n=256`, `q = 2^23 - 2^13 + 1` and `zeta = 1753`
68+
pub fn bench_ntt_dilithium_params_with_ntt_and_transforms(c: &mut Criterion) {
69+
let modulus = get_dilithium_setup();
70+
71+
let p1 = PolynomialRingZq::sample_uniform(&modulus);
72+
let p2 = PolynomialRingZq::sample_uniform(&modulus);
73+
74+
c.bench_function(
75+
"PolynomialRingZq Multiplication with NTT + Transforms (Dilithium)",
76+
|b| b.iter(|| PolynomialRingZq::mul_ntt(&p1, &p2)),
77+
);
78+
}
79+
6680
/// benchmark multiplication in typical dilithium parameter set without NTT
6781
/// `n=1024`, `q = 2^23 - 2^13 + 1` and `zeta = 1735`
6882
pub fn bench_ntt_dilithium_params_without_ntt(c: &mut Criterion) {
@@ -94,6 +108,19 @@ pub fn bench_ntt_hawk1024_params_with_ntt(c: &mut Criterion) {
94108
});
95109
}
96110

111+
/// benchmark multiplication in typical HAWK1024 parameter set with NTT and Transforms
112+
/// `n=256`, `q = 12289` and `zeta = 1945`
113+
pub fn bench_ntt_hawk1024_params_with_ntt_and_transforms(c: &mut Criterion) {
114+
let modulus = get_hawk1024_setup();
115+
116+
let p1 = PolynomialRingZq::sample_uniform(&modulus);
117+
let p2 = PolynomialRingZq::sample_uniform(&modulus);
118+
119+
c.bench_function("PolynomialRingZq Multiplication with NTT + Transforms (HAWK1024)", |b| {
120+
b.iter(|| PolynomialRingZq::mul_ntt(&p1, &p2))
121+
});
122+
}
123+
97124
/// benchmark multiplication in typical HAWK1024 parameter set without NTT
98125
/// `n=256`, `q = 12289` and `zeta = 1945`
99126
pub fn bench_ntt_hawk1024_params_without_ntt(c: &mut Criterion) {
@@ -111,7 +138,9 @@ pub fn bench_ntt_hawk1024_params_without_ntt(c: &mut Criterion) {
111138
criterion_group!(
112139
benches,
113140
bench_ntt_dilithium_params_with_ntt,
141+
bench_ntt_dilithium_params_with_ntt_and_transforms,
114142
bench_ntt_dilithium_params_without_ntt,
115143
bench_ntt_hawk1024_params_with_ntt,
116-
bench_ntt_hawk1024_params_without_ntt
144+
bench_ntt_hawk1024_params_with_ntt_and_transforms,
145+
bench_ntt_hawk1024_params_without_ntt,
117146
);

0 commit comments

Comments
 (0)