You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
544 B

  1. use criterion::{criterion_group, criterion_main, Criterion};
  2. use num::complex::{Complex, Complex64};
  3. extern crate rand;
  4. use rand::Rng;
  5. use fft_rs;
  6. fn criterion_benchmark(c: &mut Criterion) {
  7. let values: Vec<f64> = rand::thread_rng()
  8. .sample_iter(rand::distributions::Standard)
  9. .take(1024)
  10. .collect();
  11. c.bench_function("dft", |b| b.iter(|| fft_rs::dft(&values)));
  12. c.bench_function("fft", |b| b.iter(|| fft_rs::fft(&values)));
  13. }
  14. criterion_group!(benches, criterion_benchmark);
  15. criterion_main!(benches);