MATLAB: Does the FWHT function calculate slower than the FFT function, even though the documentation says they use similar algorithms

algorithmcalculationfftfftwfwhtperformanceSignal Processing Toolboxslowspeed

I am using the FFT and the FWHT function. I was expecting them to take around the same time to compute since the documentation page for FWHT says, "The fast Walsh-Hadamard transform algorithm is similar to the Cooley-Tukey algorithm used for the FFT. Both use a butterfly structure to determine the transform coefficients."
Instead, I have found that it only takes 0.5 seconds to calculate the FFT of my matrix, whereas it takes 5 seconds to calculate the FWHT of my matrix. What is causing this difference in performance?

Best Answer

MATLAB's FFT functions use a 3rd-party C library called FFTW, allowing them to be very quick.
FWHT does not use a third party library, and instead is calculated using for loops, which causes slower calculation speeds. To see the FWHT algorithm implementation in MATLAB, run the following command in the MATLAB command window to open the function's M-file:
>> edit fwht
Related Question