[SciPy-Dev] default scipy fft performance

Ralf Gommers ralf.gommers@gmail....
Fri Dec 21 13:46:31 CST 2012


On Fri, Dec 21, 2012 at 6:30 PM, Paul Anton Letnes <
paul.anton.letnes@gmail.com> wrote:

>
> On 21. des. 2012, at 16:53, David Cournapeau wrote:
>
> > On Fri, Dec 21, 2012 at 3:16 PM, Paul Anton Letnes
> > <paul.anton.letnes@gmail.com> wrote:
> >> Dear Scipy devs,
> >>
> >> 1) thanks for doing a great job in general!
> >> 2) Why is there a huge performance difference between scipy.fft and
> scipy.fftpack.fft? It apperars that scipy.fft == numpy.fft:
> >>
> >> In [4]: import numpy as np
> >>
> >> In [5]: from scipy import fft
> >>
> >> In [6]: from scipy import fftpack
> >>
> >> In [7]: d = np.linspace(0, 1e3, 1e7)
> >>
> >> In [8]: %timeit np.fft.fft(d)
> >> 1 loops, best of 3: 1.29 s per loop
> >>
> >> In [9]: %timeit fft(d)
> >> 1 loops, best of 3: 1.3 s per loop
> >>
> >> In [10]: %timeit fftpack.fft(d)
> >> 1 loops, best of 3: 651 ms per loop
> >>
> >> 3) On a related note - what's the best performing python fft
> library/wrapper out there? I take it from some google research I did that
> e.g. fftw cannot be used due to the GPL licence.
> >
> > But you could use e.g. pyfftw that will give you a better wrapper that
> > scipy ever had for FFTW.
> >
> > The difference in speed is not unexpected: the fft in numpy is there
> > for historical reasons and backward compatibility. Unless you have a
> > very good reason not to use it, you should be using scipy.fftpack
> > instead of numpy.fft when you can depend on scipy.
>
> I understand that this must be something like a backwards compatibility
> thing. But my point was (although I was perhaps not all that clear): Why
> does scipy.fft link to numpy.fft,


That is the same function; in scipy/__init__.py there's "from numpy import
*". This is again for backwards compatibility only. You should not use
anything from the main scipy namespace (except for running tests with
scipy.test()).

Ralf


> and not scipy.fftpack.fft? The interface seems similar enough:
> fft(a[, n, axis])
> fft(x[, n, axis, overwrite_x])
> The extra overwrite_x in fftpack shouldn't be much of an issue.
>
> Cheers
> Paul
>
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20121221/68699724/attachment.html 


More information about the SciPy-Dev mailing list