diff data/model/FFTModel.cpp @ 1257:5236543343c3 3.0-integration

A note on cache hit findings
author Chris Cannam
date Thu, 10 Nov 2016 09:23:05 +0000
parents d8d6d01505ed
children 200c60de27ca
line wrap: on
line diff
--- a/data/model/FFTModel.cpp	Wed Nov 09 18:08:40 2016 +0000
+++ b/data/model/FFTModel.cpp	Thu Nov 10 09:23:05 2016 +0000
@@ -291,7 +291,13 @@
 vector<complex<float>>
 FFTModel::getFFTColumn(int n) const
 {
-    for (auto &incache : m_cached) {
+    // The small cache (i.e. the m_cached deque) is for peak-frequency
+    // spectrograms, where values from two consecutive columns are
+    // needed at once. This cache gets essentially no hits when
+    // scrolling through a magnitude spectrogram but 95%+ hits with a
+    // peak-frequency spectrogram. Since it costs very little, it's
+    // well worth having.
+    for (const auto &incache : m_cached) {
         if (incache.n == n) {
             inSmallCache.hit();
             return incache.col;