Faster search for tid of zone in GetZoneParent().

This commit is contained in:
Bartosz Taudul 2021-02-07 20:17:48 +01:00
parent 35267abc8e
commit c6c9fec383

View File

@ -17191,6 +17191,21 @@ void View::CrashTooltip()
const ZoneEvent* View::GetZoneParent( const ZoneEvent& zone ) const 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() ) for( const auto& thread : m_worker.GetThreadData() )
{ {
const ZoneEvent* parent = nullptr; const ZoneEvent* parent = nullptr;