diff options
author | Lion Krischer <krischer@geophysik.uni-muenchen.de> | 2016-05-27 17:06:56 +0200 |
---|---|---|
committer | Lion Krischer <krischer@geophysik.uni-muenchen.de> | 2016-06-06 19:51:12 +0200 |
commit | 2de9651b99da9d3308de5df510cfd28c1a3a0f19 (patch) | |
tree | cfe67667ac9620a2668d1d06928f5b5008868ad3 /numpy/fft/fftpack.py | |
parent | f65b233dc5689ecbb79a4ed8a383ef0251bc39c6 (diff) | |
download | numpy-2de9651b99da9d3308de5df510cfd28c1a3a0f19.tar.gz |
ENH: Changing FFT cache to a bounded LRU cache
Replaces the simple dictionary caches for the twiddle factors of
numpy.fft to bounded LRU (least recently used) caches. The caches can
thus no longer grow without bounds.
See #7686.
Diffstat (limited to 'numpy/fft/fftpack.py')
-rw-r--r-- | numpy/fft/fftpack.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/numpy/fft/fftpack.py b/numpy/fft/fftpack.py index fe5b76e1a..78cf214d2 100644 --- a/numpy/fft/fftpack.py +++ b/numpy/fft/fftpack.py @@ -38,9 +38,10 @@ __all__ = ['fft', 'ifft', 'rfft', 'irfft', 'hfft', 'ihfft', 'rfftn', from numpy.core import (array, asarray, zeros, swapaxes, shape, conjugate, take, sqrt) from . import fftpack_lite as fftpack +from .helper import _FFTCache -_fft_cache = {} -_real_fft_cache = {} +_fft_cache = _FFTCache(max_size_in_mb=100, max_item_count=32) +_real_fft_cache = _FFTCache(max_size_in_mb=100, max_item_count=32) def _raw_fft(a, n=None, axis=-1, init_function=fftpack.cffti, |