Reference Implementations
Use this page to compare
gpu-fftagainst the libraries it most naturally gets mentioned alongside. The point is not to “win” every row. The point is to understand the narrower, browser-native slice this project intentionally serves.
How to compare responsibly
- Compare platform assumptions before comparing raw speed.
- Separate “browser-native and lightweight” from “maximal platform-specific performance”.
- Treat any performance judgment as target-hardware-specific unless you have matching benchmark evidence.
Production FFT Libraries
CPU Reference Implementations
[FFTW3](https://www.fftw.org/)
The de facto standard FFT library for C/C++. Features adaptive algorithm selection ("planning") that optimizes for the specific hardware and transform size. MIT License.
C · GPL/MIT · Multi-platform
[Kiss FFT](https://github.com/mborgerding/kissfft)
Minimalist FFT designed for embedded systems. Simple codebase (~500 lines) makes it easy to understand and port. Our CPU fallback shares similar design philosophy.
C · BSD-3-Clause · Embedded-friendly
[pocketfft](https://gitlab.mpcdf.mpg.de/mtr/pocketfft)
Header-only C++ FFT library derived from FFTW. Used in NumPy's FFT implementation. Lightweight and easy to integrate.
C++ · BSD-3-Clause · Header-only
[Intel MKL FFT](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html)
Intel's Math Kernel Library includes highly optimized FFT routines for x86 processors. Leverages AVX-512 and other SIMD extensions.
C/Fortran · Proprietary · x86 optimized
[Apple Accelerate FFT](https://developer.apple.com/documentation/accelerate/fast_fourier_transforms)
Apple's framework provides hardware-optimized FFT on macOS and iOS. Integrates with vDSP for SIMD acceleration.
C/Swift · Proprietary · Apple platforms
GPU Implementations
[cuFFT](https://docs.nvidia.com/cuda/cufft/)
NVIDIA's GPU FFT library. Supports 1D, 2D, 3D transforms up to 2³¹ elements. Optimized for CUDA architectures with automatic algorithm selection.
CUDA · Proprietary · NVIDIA GPUs
[vkFFT](https://github.com/DTolm/VkFFT)
Cross-platform GPU FFT supporting Vulkan, CUDA, OpenCL, Metal, and WebGPU. Demonstrates advanced optimization techniques. Similar algorithmic approach to this library.
C++ · MIT · Cross-GPU
[clFFT](https://github.com/ROCmSoftwarePlatform/clFFT)
OpenCL FFT library supporting AMD, NVIDIA, and Intel GPUs. Now part of AMD's ROCm stack.
OpenCL · Apache 2.0 · AMD/NVIDIA/Intel
[rocFFT](https://github.com/ROCmSoftwarePlatform/rocFFT)
AMD's GPU FFT library for ROCm platform. Features optimized kernels for AMD GPU architectures.
HIP · MIT · AMD GPUs
[oneMKL FFT](https://github.com/oneapi-src/oneMKL)
Intel's oneAPI Math Kernel Library with FFT routines supporting both CPU (via Intel MKL) and GPU (via DPC++/SYCL).
DPC++ · Apache 2.0 · Intel GPUs/CPU
JavaScript / Web
[TensorFlow.js FFT](https://js.tensorflow.org/)
Provides `tf.spectral.fft()` via WebGL compute shaders. Part of the TensorFlow.js ecosystem. Our WebGPU implementation targets lower overhead for pure FFT workloads.
TypeScript · Apache 2.0 · WebGL
[gpu.js](https://gpu.rocks/)
General-purpose GPU computation via WebGL. Includes FFT examples. Less specialized than our WGSL compute shader implementation.
JavaScript · MIT · WebGL
[dsp.js](https://github.com/corbanbrook/dsp.js/)
JavaScript DSP library with FFT implementation. Pure JavaScript, runs on any environment. Useful reference for algorithm structure.
JavaScript · MIT · Pure JS
[ml-fft](https://github.com/image-js/ml-fft)
FFT library for machine learning applications in JavaScript. Part of the ImageJS ecosystem.
JavaScript · MIT · Pure JS
Implementation Comparison
| Library | Platform | Algorithm | Arbitrary Size | Multi-dimensional |
|---|---|---|---|---|
| webgpu-fft (this) | WebGPU + CPU JS | Radix-2 DIT | No (power-of-2 only) | Up to 2D |
| FFTW3 | CPU | Adaptive | Yes | Yes (any dimension) |
| cuFFT | NVIDIA GPU | Multiple | Yes | Yes (up to 3D) |
| vkFFT | Cross-GPU | Multiple | Yes | Yes (up to 4D) |
| Kiss FFT | CPU | Radix-2, -4 | Limited | Up to 3D |
| TensorFlow.js | WebGL | Radix-2 | No | Up to 3D |
Algorithmic Approaches
Radix-2 Decimation-in-Time (This Library)
1. Bit-reversal permutation
2. Log₂(n) butterfly stages
3. Twiddle factor multiplication1
2
3
2
3
Pros: Simple implementation, GPU-friendly, predictable memory access Cons: Requires power-of-2 sizes
Mixed-Radix (FFTW, cuFFT, vkFFT)
1. Factorize n = p₁ × p₂ × ... × pₖ
2. Apply radix-pᵢ kernels for each factor
3. Support for n with factors 2, 3, 5, 7, 11, etc.1
2
3
2
3
Pros: Supports arbitrary sizes, better cache utilization Cons: More complex code, more kernel variants
Bluestein / Chirp Z-Transform
1. Convert DFT to convolution
2. Zero-pad to power-of-2
3. Use standard FFT1
2
3
2
3
Pros: Supports any size Cons: ~2x more operations, more memory
Performance comparison rule
Run npm run benchmark on your target hardware before drawing any GPU versus CPU conclusions. This repository intentionally avoids publishing static crossover numbers because they depend too heavily on browser, adapter, and workload shape.
Related Resources
- Academic Papers - Foundational FFT research
- Learning Resources - Tutorials and guides
- Benchmarks - Performance measurements