Skip to content

Commit

Permalink
Move planner completely outside of bench function
Browse files Browse the repository at this point in the history
  • Loading branch information
smu160 committed Jul 1, 2024
1 parent 9db5739 commit 0301325
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ fn benchmark_forward_f32(c: &mut Criterion) {
for n in LENGTHS.iter() {
let len = 1 << n;
let id = format!("FFT Forward f32 {} elements", len);
let planner = Planner32::new(len, Direction::Forward);

c.bench_function(&id, |b| {
let (mut reals, mut imags) = generate_numbers(len);
let planner = Planner32::new(len, Direction::Forward);
b.iter(|| {
black_box(fft_32_with_opts_and_plan(
&mut reals, &mut imags, &options, &planner,
Expand All @@ -61,9 +62,10 @@ fn benchmark_inverse_f32(c: &mut Criterion) {
for n in LENGTHS.iter() {
let len = 1 << n;
let id = format!("FFT Inverse f32 {} elements", len);
let planner = Planner32::new(len, Direction::Reverse);

c.bench_function(&id, |b| {
let (mut reals, mut imags) = generate_numbers(len);
let planner = Planner32::new(len, Direction::Reverse);
b.iter(|| {
black_box(fft_32_with_opts_and_plan(
&mut reals, &mut imags, &options, &planner,
Expand All @@ -79,9 +81,10 @@ fn benchmark_forward_f64(c: &mut Criterion) {
for n in LENGTHS.iter() {
let len = 1 << n;
let id = format!("FFT Forward f64 {} elements", len);
let planner = Planner64::new(len, Direction::Forward);

c.bench_function(&id, |b| {
let (mut reals, mut imags) = generate_numbers(len);
let planner = Planner64::new(len, Direction::Forward);
b.iter(|| {
black_box(fft_64_with_opts_and_plan(
&mut reals, &mut imags, &options, &planner,
Expand All @@ -97,9 +100,10 @@ fn benchmark_inverse_f64(c: &mut Criterion) {
for n in LENGTHS.iter() {
let len = 1 << n;
let id = format!("FFT Inverse f64 {} elements", len);
let planner = Planner64::new(len, Direction::Reverse);

c.bench_function(&id, |b| {
let (mut reals, mut imags) = generate_numbers(len);
let planner = Planner64::new(len, Direction::Reverse);
b.iter(|| {
black_box(fft_64_with_opts_and_plan(
&mut reals, &mut imags, &options, &planner,
Expand Down

0 comments on commit 0301325

Please sign in to comment.