mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-04 06:43:07 +00:00
parent
d497c10858
commit
d41924dad3
@ -36,6 +36,10 @@ harness = false
|
|||||||
name = "ffts"
|
name = "ffts"
|
||||||
harness = false
|
harness = false
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "transpose"
|
||||||
|
harness = false
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
#lto = "fat"
|
#lto = "fat"
|
||||||
|
|||||||
26
benches/transpose.rs
Normal file
26
benches/transpose.rs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
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);
|
||||||
@ -35,7 +35,7 @@ pub(crate) fn transpose_poly_values<F: Field>(polys: Vec<PolynomialValues<F>>) -
|
|||||||
transpose(&poly_values)
|
transpose(&poly_values)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn transpose<F: Field>(matrix: &[Vec<F>]) -> Vec<Vec<F>> {
|
pub fn transpose<F: Field>(matrix: &[Vec<F>]) -> Vec<Vec<F>> {
|
||||||
let l = matrix.len();
|
let l = matrix.len();
|
||||||
let w = matrix[0].len();
|
let w = matrix[0].len();
|
||||||
let mut transposed = vec![vec![F::ZERO; l]; w];
|
let mut transposed = vec![vec![F::ZERO; l]; w];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user