Skip to content

Script comparing the speed of the Fast Fourier Transform implemented in different libraries

Notifications You must be signed in to change notification settings

VasilyevEvgeny/fft_comparator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

What is it?

Script that compares the speed of several implementations of the Fast Fourier Transform:

Installation

  • Windows:
virtualenv .venv
cd .venv/Scripts
activate
pip install -r <path_to_project>/requirements.txt
  • Linux
virtualenv .venv -p python3
cd .venv/bin
source ./activate
pip install -r <path_to_project>/requirements.txt

Comparison

For randomly generated one-dimensional and two-dimensional arrays, a direct FFT is performed, then the power spectral density is calculated, and then the inverse FFT is calculated. The procedure is repeated several times, after which the average execution time of the indicated operations is calculated. For one-dimensional arrays, averaging occurs over 50,000 implementations, for two-dimensional arrays, over 500. The resulting times are normalized to the time of the FFT using the library numpy. The results are presented below:

1D array 2D array
1d 2d

It can be seen that in the case of a one-dimensional array, the pyfftw library modules, simulating the numpy and scipy interfaces, as well as the pyfftw.builders module, lose much in speed. The explanation is that for a one-dimensional array, the time for preliminary internal parameter adjustment, which always happens in pyfftw, is comparable to the time of the entire transfrom. In the case of a two-dimensional array, this time is short, therefore, the implementation of transformations in the indicated modules is faster than in those whose interface they repeat. Note that the FFT from scipy is always a little more efficient than from numpy, and the speed of transform in pyfftw with preliminary creation of plans is at least 2-3 times higher than all the others.

About

Script comparing the speed of the Fast Fourier Transform implemented in different libraries

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages