From e5ae1ea2cc73acceec42f56fbdd9b8b75599287b Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 20 Jan 2020 23:53:04 +0100 Subject: [PATCH] Only perform search, if necessary. --- server/TracyView.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 74f3e46c..f2dc1f13 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -9133,6 +9133,8 @@ void View::DrawFindZone() const auto groupBy = m_findZone.groupBy; const auto highlightActive = m_findZone.highlight.active; const auto limitRange = m_findZone.limitRange; + FindZone::Group* group = nullptr; + uint64_t lastGid = std::numeric_limits::max() - 1; while( processed < sz ) { auto& ev = zones[processed]; @@ -9199,13 +9201,17 @@ void View::DrawFindZone() assert( false ); break; } - auto it = m_findZone.groups.find( gid ); - if( it == m_findZone.groups.end() ) + if( lastGid != gid ) { - it = m_findZone.groups.emplace( gid, FindZone::Group { m_findZone.groupId++ } ).first; - it->second.zones.reserve( 1024 ); + lastGid = gid; + auto it = m_findZone.groups.find( gid ); + if( it == m_findZone.groups.end() ) + { + it = m_findZone.groups.emplace( gid, FindZone::Group { m_findZone.groupId++ } ).first; + it->second.zones.reserve( 1024 ); + } + group = &it->second; } - FindZone::Group* group = &it->second; group->time += timespan; group->zones.push_back_non_empty( ev.Zone() ); }