I have been doing a study which part of it includes a comparison of computation time vs window type and length (among some other things in the computation time, however I speak in terms of relative computation time).
I found that among three windows I tested: Hann, Hamming and Blackman; the Blackman window had the slowest computation time (albeit only by ~20ms) with the Hann window outperforming the rest. This was tested over 100 runs for each.
My question is, why is this the case? Is there something specific about the windowing function (as well as FFT length of course) that causes this increase in computation time? Are there any sources for justification that explores this in more depth?
For reference, my input signal samples are 2s long with sampling rate of 2MHz, so a total length of 4,000,000 samples. The code I am using is as follows:
from datetime import datetime
from scipy import signal
for window in ['hann', 'hamming', 'blackman']: #'hamming', 'hann',
for nperseg in [1024, 2048, 4096, 8192, 16384]: # 1024, 2048, 4096, 8192
win = signal.windows.get_window(window, nperseg)
et = 0
for i in range(0, 100):
start_time = datetime.now() # time.monotonic()
f, t, Zxx = signal.stft(x, fs=fs, window=win, nperseg=nperseg)
end_time = datetime.now() # time.monotonic()
et += (end_time - start_time).total_seconds() * 1000 # convert to ms
print(f'Time Taken (window={window},nperseg={nperseg}): {et / 100}ms')