Browse Source

Add initial benchmarks

main
arnaucube 4 years ago
parent
commit
1c54c82c5f
1 changed files with 22 additions and 0 deletions
  1. +22
    -0
      benches/bench_fft.rs

+ 22
- 0
benches/bench_fft.rs

@ -0,0 +1,22 @@
use criterion::{criterion_group, criterion_main, Criterion};
use num::complex::{Complex, Complex64};
extern crate rand;
use rand::Rng;
use fft_rs;
fn criterion_benchmark(c: &mut Criterion) {
let values: Vec<f64> = rand::thread_rng()
.sample_iter(rand::distributions::Standard)
.take(1024)
.collect();
c.bench_function("dft", |b| b.iter(|| fft_rs::dft(&values)));
c.bench_function("fft", |b| b.iter(|| fft_rs::fft(&values)));
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);

Loading…
Cancel
Save