Don't load vector size twice.

This commit is contained in:
Bartosz Taudul 2020-02-23 15:35:08 +01:00
parent 02d200878d
commit 759fd15c03

View File

@ -2757,14 +2757,15 @@ void Worker::NewZone( ZoneEvent* zone, uint64_t thread )
auto td = m_threadCtxData; auto td = m_threadCtxData;
if( !td ) td = m_threadCtxData = NoticeThread( thread ); if( !td ) td = m_threadCtxData = NoticeThread( thread );
td->count++; td->count++;
if( td->stack.empty() ) const auto ssz = td->stack.size();
if( ssz == 0 )
{ {
td->stack.push_back( zone ); td->stack.push_back( zone );
td->timeline.push_back( zone ); td->timeline.push_back( zone );
} }
else else
{ {
auto& back = td->stack.back(); auto& back = td->stack.data()[ssz-1];
if( !back->HasChildren() ) if( !back->HasChildren() )
{ {
back->SetChild( int32_t( m_data.zoneChildren.size() ) ); back->SetChild( int32_t( m_data.zoneChildren.size() ) );