|
1 | | -use super::utils::{rand_field_elements, rand_poly, FE}; |
| 1 | +use super::utils::{rand_complex_mersenne_poly, rand_field_elements, rand_poly, FE}; |
2 | 2 | use const_random::const_random; |
3 | 3 | use core::hint::black_box; |
4 | 4 | use criterion::Criterion; |
5 | | -use lambdaworks_math::polynomial::Polynomial; |
| 5 | +use lambdaworks_math::{ |
| 6 | + field::fields::mersenne31::extensions::Degree2ExtensionField, polynomial::Polynomial, |
| 7 | +}; |
6 | 8 |
|
7 | 9 | pub fn polynomial_benchmarks(c: &mut Criterion) { |
8 | 10 | let mut group = c.benchmark_group("Polynomial"); |
@@ -42,6 +44,25 @@ pub fn polynomial_benchmarks(c: &mut Criterion) { |
42 | 44 | let y_poly = rand_poly(order); |
43 | 45 | bench.iter(|| black_box(&x_poly) * black_box(&y_poly)); |
44 | 46 | }); |
| 47 | + group.bench_function("fast mul", |bench| { |
| 48 | + let x_poly = rand_complex_mersenne_poly(order as u32); |
| 49 | + let y_poly = rand_complex_mersenne_poly(order as u32); |
| 50 | + bench.iter(|| black_box(&x_poly) * black_box(&y_poly)); |
| 51 | + }); |
| 52 | + |
| 53 | + let big_order = 9; |
| 54 | + let x_poly = rand_complex_mersenne_poly(big_order); |
| 55 | + let y_poly = rand_complex_mersenne_poly(big_order); |
| 56 | + group.bench_function("fast_mul big poly", |bench| { |
| 57 | + bench.iter(|| { |
| 58 | + black_box(&x_poly) |
| 59 | + .fast_multiplication::<Degree2ExtensionField>(black_box(&y_poly)) |
| 60 | + .unwrap() |
| 61 | + }); |
| 62 | + }); |
| 63 | + group.bench_function("slow mul big poly", |bench| { |
| 64 | + bench.iter(|| black_box(&x_poly) * black_box(&y_poly)); |
| 65 | + }); |
45 | 66 |
|
46 | 67 | group.bench_function("div", |bench| { |
47 | 68 | let x_poly = rand_poly(order); |
|
0 commit comments