From c6c9fec383a9ad3d72b50685757ff428354058af Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 7 Feb 2021 20:17:48 +0100 Subject: [PATCH] Faster search for tid of zone in GetZoneParent(). --- server/TracyView.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index bc9fd8a5..0d0fe801 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -17191,6 +17191,21 @@ void View::CrashTooltip() const ZoneEvent* View::GetZoneParent( const ZoneEvent& zone ) const { +#ifndef TRACY_NO_STATISTICS + if( m_worker.AreSourceLocationZonesReady() ) + { + auto& slz = m_worker.GetZonesForSourceLocation( zone.SrcLoc() ); + if( !slz.zones.empty() ) + { + auto it = std::lower_bound( slz.zones.begin(), slz.zones.end(), zone.Start(), [] ( const auto& lhs, const auto& rhs ) { return lhs.Zone()->Start() < rhs; } ); + if( it != slz.zones.end() && it->Zone() == &zone ) + { + return GetZoneParent( zone, m_worker.DecompressThread( it->Thread() ) ); + } + } + } +#endif + for( const auto& thread : m_worker.GetThreadData() ) { const ZoneEvent* parent = nullptr;