From 336d36af53ae2f79dc8c5211caf6f250e7136310 Mon Sep 17 00:00:00 2001 From: Michael Bloom Date: Sat, 7 Oct 2023 16:21:52 -0400 Subject: [PATCH] Make coeff and lookup arrays static constexpr to avoid copying to stack. Benchmark time went down about -12% --- include/sdsp/fft.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/sdsp/fft.h b/include/sdsp/fft.h index 0f19923..7b50368 100644 --- a/include/sdsp/fft.h +++ b/include/sdsp/fft.h @@ -228,8 +228,8 @@ namespace sdsp static_assert(isPowerOf2(N), "FFT size must be a power of 2!"); //compile time calculations - constexpr auto wCoeffs {calc_wCoeffs()}; - constexpr auto swapLookup {calc_swap_lookup()}; + constexpr static auto wCoeffs {calc_wCoeffs()}; + constexpr static auto swapLookup {calc_swap_lookup()}; //decimation in time //perform swap on inputs @@ -272,9 +272,9 @@ namespace sdsp static_assert(isPowerOf4(N), "FFT radix 4 size must be a power of 4!"); //compile time calculations - constexpr auto wCoeffs {calc_wCoeffs()}; - constexpr auto swapLookup {calc_swap_lookup()}; - constexpr uint coeff_subscript {log2(N) - 1}; + constexpr static auto wCoeffs {calc_wCoeffs()}; + constexpr static auto swapLookup {calc_swap_lookup()}; + constexpr static uint coeff_subscript {log2(N) - 1}; for (uint i {0}; i < log4(N); i++) { uint i_group_size {static_cast(N) / (4u << (2u * i))};