From 94a195733898ca3eb7349071a0b5c9da73ab7edf Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 18 Mar 2019 18:42:58 +0100 Subject: [PATCH] Optimize zone skipping. --- server/TracyView.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index e500ee6d..11090ae7 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -2525,14 +2525,18 @@ int View::SkipZoneLevel( const Vector& vec, bool hover, double pxns, if( zsz < MinVisSize ) { auto px1 = ( end - m_zvStart ) * pxns; + auto rend = end; for(;;) { - ++it; + const auto prevIt = it; + it = std::lower_bound( it, zitend, std::max( rend + nspx, end + MinVisSize ), [] ( const auto& l, const auto& r ) { return (uint64_t)l->end < (uint64_t)r; } ); + if( it == prevIt ) ++it; if( it == zitend ) break; const auto nend = m_worker.GetZoneEnd( **it ); const auto pxnext = ( nend - m_zvStart ) * pxns; if( pxnext - px1 >= MinVisSize * 2 ) break; px1 = pxnext; + rend = nend; } } else