From a76622d17ab41fcca17eada9156d68d9dd0bee42 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 3 Aug 2019 14:35:01 +0200 Subject: Cache last searched ThreadData. --- server/TracyWorker.hpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'server/TracyWorker.hpp') diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index 2915c0de..2acbc89c 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -137,7 +137,7 @@ private: struct DataBlock { - DataBlock() : zonesCnt( 0 ), lastTime( 0 ), frameOffset( 0 ), threadLast( std::numeric_limits::max(), 0 ) {} + DataBlock() : zonesCnt( 0 ), lastTime( 0 ), frameOffset( 0 ), threadLast( std::numeric_limits::max(), 0 ), threadDataLast( std::numeric_limits::max(), nullptr ) {} std::shared_mutex lock; StringDiscovery frames; @@ -177,6 +177,7 @@ private: flat_hash_map> threadMap; Vector threadExpand; std::pair threadLast; + std::pair threadDataLast; Vector> zoneChildren; Vector> gpuChildren; @@ -430,8 +431,13 @@ private: void InsertMessageData( MessageData* msg, uint64_t thread ); + ThreadData* NoticeThreadReal( uint64_t thread ); ThreadData* NewThread( uint64_t thread ); - ThreadData* NoticeThread( uint64_t thread ); + ThreadData* NoticeThread( uint64_t thread ) + { + if( m_data.threadDataLast.first == thread ) return m_data.threadDataLast.second; + return NoticeThreadReal( thread ); + } tracy_force_inline void NewZone( ZoneEvent* zone, uint64_t thread ); -- cgit v1.2.3