From 4186a71ee7073fd2db0adb47afaf373b11ef828f Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 16 Jun 2019 01:28:36 +0200 Subject: [PATCH] Cache sorted begin and end iterators. --- server/TracyView.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 495e8500..277adfae 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -6267,17 +6267,20 @@ void View::DrawFindZone() const auto& sorted = m_findZone.sorted; + auto sortedBegin = sorted.begin(); + auto sortedEnd = sorted.end(); + while( sortedBegin != sortedEnd && *sortedBegin == 0 ) ++sortedBegin; + if( m_findZone.logTime ) { const auto tMinLog = log10( tmin ); const auto zmax = ( log10( tmax ) - tMinLog ) / numBins; { - auto zit = sorted.begin(); - while( zit != sorted.end() && *zit == 0 ) ++zit; + auto zit = sortedBegin; for( int64_t i=0; i= s && *(sorted.end()-1) <= e ) selectionTime += timeSum; + if( m_findZone.highlight.active && *zit >= s && *(sortedEnd-1) <= e ) selectionTime += timeSum; } if( m_findZone.selGroup != m_findZone.Unselected ) @@ -6318,12 +6321,11 @@ void View::DrawFindZone() else { const auto zmax = tmax - tmin; - auto zit = sorted.begin(); - while( zit != sorted.end() && *zit == 0 ) ++zit; + auto zit = sortedBegin; for( int64_t i=0; i= s && *(sorted.end()-1) <= e ) selectionTime += timeSum; + if( m_findZone.highlight.active && *zit >= s && *(sortedEnd-1) <= e ) selectionTime += timeSum; if( m_findZone.selGroup != m_findZone.Unselected ) {