I'm trying to experiment with audio analysis on the Pico and am running into slower than expected performance.
I've specifically picked this board because it runs on the Cortex M4 MCU with accelerated DSP via CMSIS. (It is unclear if it has an FPU, but I'm not using it here, so...) I've run some timings and am getting ~44ms to run E.FFT() on a 128 16-bit data:
var w = new Waveform(128, {doubleBuffer:true, bits:16});
var a = new Uint16Array(128);
w.on("buffer", function(buf) {
LED1.reset();
var l = buf.length;
a.set(buf);
var start = Date.now();
E.FFT(a);
console.log(Date.now() - start);
LED1.set();
});
w.startInput(B1, 44100, {repeat:true});
At best, this is 1000/44 = 22.72 FFTs per second.
According to benchmarks done in http://openaudio.blogspot.com/2016/09/benchmarking-fft-speed.html, Arduino M0, which has a slower chip with no DSP unit does 639 FFTs per second, while a Teensy 3.2, which runs a similarly specced NXP chip manages 7156 FFTs per second when not using accelerated DSP and 14286 when doing so.
So, what's going on? Am I reading it wrong or calling it wrong?
I get that their benchmark is in C while Pico is running interpreted JS, but E.FFT() just calls into the C library function, so there shouldn't be much overhead there. Looking at the GitHub sources, I do see that on the Pico, E.FFT() supposedly calls into CMSIS, so this should be really fast.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I'm trying to experiment with audio analysis on the Pico and am running into slower than expected performance.
I've specifically picked this board because it runs on the Cortex M4 MCU with accelerated DSP via CMSIS. (It is unclear if it has an FPU, but I'm not using it here, so...) I've run some timings and am getting ~44ms to run E.FFT() on a 128 16-bit data:
At best, this is 1000/44 = 22.72 FFTs per second.
According to benchmarks done in http://openaudio.blogspot.com/2016/09/benchmarking-fft-speed.html, Arduino M0, which has a slower chip with no DSP unit does 639 FFTs per second, while a Teensy 3.2, which runs a similarly specced NXP chip manages 7156 FFTs per second when not using accelerated DSP and 14286 when doing so.
So, what's going on? Am I reading it wrong or calling it wrong?
I get that their benchmark is in C while Pico is running interpreted JS, but E.FFT() just calls into the C library function, so there shouldn't be much overhead there. Looking at the GitHub sources, I do see that on the Pico, E.FFT() supposedly calls into CMSIS, so this should be really fast.