plonky2/src/bin/bench_ldes.rs
Daniel Lubarov 5fe8d633b6 Split main into multiple binaries
... and other minor refactoring.

`bench_recursion` will be the default bin run by `cargo run`; the otheres can be selected with the `--bin` flag.

We could probably delete some of the other binaries later. E.g. `field_search` might not be useful any more. `bench_fft` should maybe be converted to a benchmark (although there are some pros and cons, e.g. the bench framework has a minimum number of runs, and isn't helpful in testing multi-core performance).
2021-04-06 13:23:47 -07:00

34 lines
1.0 KiB
Rust

use std::time::Instant;
use rayon::prelude::*;
use plonky2::field::crandall_field::CrandallField;
use plonky2::field::fft;
use plonky2::field::field::Field;
use plonky2::polynomial::polynomial::{PolynomialCoeffs, PolynomialValues};
type F = CrandallField;
// 113 wire polys, 3 Z polys, 4 parts of quotient poly.
const PROVER_POLYS: usize = 113 + 3 + 4;
fn main() {
const DEGREE: usize = 1 << 13;
const RATE_BITS: usize = 3;
let start = Instant::now();
(0usize..PROVER_POLYS).into_par_iter().for_each(|i| {
let mut values = vec![CrandallField::ZERO; DEGREE];
for j in 0usize..DEGREE {
values[j] = CrandallField((i * j) as u64);
}
let poly_values = PolynomialValues::new(values);
let start = Instant::now();
let result = poly_values.lde(RATE_BITS);
let duration = start.elapsed();
println!("LDE took {:?}", duration);
println!("LDE result: {:?}", result.values[0]);
});
println!("FFT overall took {:?}", start.elapsed());
}