@@ -13,7 +13,7 @@ use utilities::rustfft::num_complex::Complex;
13
13
use utilities:: rustfft:: FftPlanner ;
14
14
15
15
const LENGTHS : & [ usize ] = & [
16
- 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 , 25 , 26 , 27 , 28 ,
16
+ 6 , 7 , 8 , 9 , 10 , 11 , 12 , 13 , 14 , 15 , 16 , 17 , 18 , 19 , 20 , 21 , 22 , 23 , 24 ,
17
17
] ;
18
18
19
19
fn generate_numbers < T : Float > ( n : usize ) -> ( Vec < T > , Vec < T > )
@@ -69,7 +69,7 @@ fn benchmark_forward_f32(c: &mut Criterion) {
69
69
let planner = Planner32 :: new ( len, Direction :: Forward ) ;
70
70
let ( mut reals, mut imags) = generate_numbers ( len) ;
71
71
72
- group. bench_with_input ( BenchmarkId :: new ( id, len) , & len, |b, & len | {
72
+ group. bench_with_input ( BenchmarkId :: new ( id, len) , & len, |b, & _len | {
73
73
b. iter ( || {
74
74
fft_32_with_opts_and_plan (
75
75
black_box ( & mut reals) ,
@@ -85,7 +85,7 @@ fn benchmark_forward_f32(c: &mut Criterion) {
85
85
let fft = planner. plan_fft_forward ( len) ;
86
86
let mut signal = generate_complex_numbers ( len) ;
87
87
88
- group. bench_with_input ( BenchmarkId :: new ( id, len) , & len, |b, & len | {
88
+ group. bench_with_input ( BenchmarkId :: new ( id, len) , & len, |b, & _len | {
89
89
b. iter ( || fft. process ( black_box ( & mut signal) ) ) ;
90
90
} ) ;
91
91
}
@@ -103,31 +103,49 @@ fn benchmark_inverse_f32(c: &mut Criterion) {
103
103
c. bench_function ( & id, |b| {
104
104
let ( mut reals, mut imags) = generate_numbers ( len) ;
105
105
b. iter ( || {
106
- black_box ( fft_32_with_opts_and_plan (
107
- & mut reals, & mut imags, & options, & planner,
108
- ) ) ;
106
+ fft_32_with_opts_and_plan (
107
+ black_box ( & mut reals) ,
108
+ black_box ( & mut imags) ,
109
+ black_box ( & options) ,
110
+ black_box ( & planner) ,
111
+ ) ;
109
112
} ) ;
110
113
} ) ;
111
114
}
112
115
}
113
116
114
117
fn benchmark_forward_f64 ( c : & mut Criterion ) {
115
- let options = Options :: default ( ) ;
118
+ let mut group = c . benchmark_group ( "Forward f64" ) ;
116
119
117
120
for n in LENGTHS . iter ( ) {
118
121
let len = 1 << n;
119
- let id = format ! ( "FFT Forward f64 {} elements" , len) ;
122
+ let id = "PhastFT FFT Forward" ;
123
+ let options = Options :: guess_options ( len) ;
120
124
let planner = Planner64 :: new ( len, Direction :: Forward ) ;
125
+ let ( mut reals, mut imags) = generate_numbers ( len) ;
126
+ group. throughput ( Throughput :: Elements ( len as u64 ) ) ;
121
127
122
- c. bench_function ( & id, |b| {
123
- let ( mut reals, mut imags) = generate_numbers ( len) ;
128
+ group. bench_with_input ( BenchmarkId :: new ( id, len) , & len, |b, & _len| {
124
129
b. iter ( || {
125
- black_box ( fft_64_with_opts_and_plan (
126
- & mut reals, & mut imags, & options, & planner,
127
- ) ) ;
130
+ fft_64_with_opts_and_plan (
131
+ black_box ( & mut reals) ,
132
+ black_box ( & mut imags) ,
133
+ black_box ( & options) ,
134
+ black_box ( & planner) ,
135
+ ) ;
128
136
} ) ;
129
137
} ) ;
138
+
139
+ let id = "RustFFT FFT Forward" ;
140
+ let mut planner = FftPlanner :: < f64 > :: new ( ) ;
141
+ let fft = planner. plan_fft_forward ( len) ;
142
+ let mut signal = generate_complex_numbers ( len) ;
143
+
144
+ group. bench_with_input ( BenchmarkId :: new ( id, len) , & len, |b, & _len| {
145
+ b. iter ( || fft. process ( black_box ( & mut signal) ) ) ;
146
+ } ) ;
130
147
}
148
+ group. finish ( ) ;
131
149
}
132
150
133
151
fn benchmark_inverse_f64 ( c : & mut Criterion ) {
@@ -141,9 +159,12 @@ fn benchmark_inverse_f64(c: &mut Criterion) {
141
159
c. bench_function ( & id, |b| {
142
160
let ( mut reals, mut imags) = generate_numbers ( len) ;
143
161
b. iter ( || {
144
- black_box ( fft_64_with_opts_and_plan (
145
- & mut reals, & mut imags, & options, & planner,
146
- ) ) ;
162
+ fft_64_with_opts_and_plan (
163
+ black_box ( & mut reals) ,
164
+ black_box ( & mut imags) ,
165
+ black_box ( & options) ,
166
+ black_box ( & planner) ,
167
+ ) ;
147
168
} ) ;
148
169
} ) ;
149
170
}
0 commit comments