# HG changeset patch # User Chris Cannam # Date 1453486326 0 # Node ID 2dc27f0f97ad7323557dcb1c717f97feb19e190b # Parent 546d4e417346bc17cda446e7ea6064c2d21bc3bb Small possible speedup diff -r 546d4e417346 -r 2dc27f0f97ad data/model/Dense3DModelPeakCache.cpp --- a/data/model/Dense3DModelPeakCache.cpp Fri Jan 22 17:08:02 2016 +0000 +++ b/data/model/Dense3DModelPeakCache.cpp Fri Jan 22 18:12:06 2016 +0000 @@ -94,13 +94,16 @@ } Column peak; + int n = 0; for (int i = 0; i < m_resolution; ++i) { Column here = m_source->getColumn(column * m_resolution + i); if (i == 0) { peak = here; + n = int(peak.size()); } else { - for (int j = 0; in_range_for(peak, j) && in_range_for(here, j); ++j) { - if (here[j] > peak[j]) peak[j] = here[j]; + int m = std::min(n, int(here.size())); + for (int j = 0; j < m; ++j) { + peak[j] = std::max(here[j], peak[j]); } } }