mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-03 22:33:06 +00:00
27 lines
1002 B
Rust
27 lines
1002 B
Rust
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
|
|
use plonky2::field::crandall_field::CrandallField;
|
|
use plonky2::field::field_types::Field;
|
|
use plonky2::util::transpose;
|
|
|
|
fn criterion_benchmark(c: &mut Criterion) {
|
|
type F = CrandallField;
|
|
|
|
// In practice, for the matrices we care about, each row is associated with a polynomial of
|
|
// degree 2^13, and has been low-degree extended to a length of 2^16.
|
|
const WIDTH: usize = 1 << 16;
|
|
|
|
let mut group = c.benchmark_group("transpose");
|
|
|
|
// We have matrices with various numbers of polynomials. For example, the witness matrix
|
|
// involves 100+ polynomials.
|
|
for height in [5, 50, 100, 150] {
|
|
group.bench_with_input(BenchmarkId::from_parameter(height), &height, |b, _| {
|
|
let matrix = (0..height).map(|_| F::rand_vec(WIDTH)).collect::<Vec<_>>();
|
|
b.iter(|| transpose(&matrix));
|
|
});
|
|
}
|
|
}
|
|
|
|
criterion_group!(benches, criterion_benchmark);
|
|
criterion_main!(benches);
|