WebAudio FFT Performance Test
To have a simple repeatable test for looking at performance of JS FFT implementations run realtime within WebAudio using ScriptProcessorNode
now, and AudioWorker
node (when that's added) to compare and contrast against native implementation.
This fell out of the WebAudio Spec discussion
Runs simple FFT passes over random data using either dsp.js, jsfft or fft-asm.js. (Please fork and add more)
The FFT size is settable, and so is the length of time the data is collected. The chunkSize for the ScriptProcessorNode
is set to the same as FFT size.
The data collected is DOMHighResolutionTimeStamp at the following moments :
- immediately at the beginning callback of the
ScriptProcessorNode
:onAudioProcessStart
- before FFT calculation :
onFFTStart
- after FFT calculation :
onFFTEnd
- at the end of callback of the
ScriptProcessorNode
:onAudioProcessEnd
Using this data, the current graph plots :
- the time difference between successive
ScriptProcessorNode
callbacks :(onAudioProcessStart[index]-onAudioProcessEnd[index-1])
- labelled asCallback (msec)
- the time taken for the FFT :
perf.onFFTEnd[index]-perf.onFFTStart[index]
- labelled asFFTTime (msec)
MIT