Time to compute FFT of a VectorXd of length 100000 ~ 0.1 sec.
Time to compute FFT of a VectorXd of length 100001 ~ 10 sec
Steps to reproduce:
Compile and run the following code.
Runs in less than 0.1 sec on my machine.
Then, change line defining "length" to increase it by one.
Runs in about 10 sec on my machine.
int const length = 100000;
//int const length = 100001;
Eigen::VectorXcd x = Eigen::VectorXcd::Zero( length );
fft.fwd( fft_of_x, x );
printf( "%g\n", fft_of_x[ 0 ].real() );
I observed similar degradation with and without optimization (-O2).
Issue disappears when I use the fftw backend.
I'm pretty sure this is mostly because 100000 nicely factorizes into numbers <=5 but 100001 does not. Very likely FFTW does much more sophisticated things to work on "odd-sized" inputs (i.e., sizes with large factors).
If anyone knows how to implement this for the default backend (without entirely copying FFTW), patches are welcome.
An obvious workaround is of course to use the FFTW-backend, if necessary.
-- GitLab Migration Automatic Message --
This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1717.