From 79c437ba7ffe122f7313e1424e5b83686e402c59 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 18 Aug 2018 19:29:04 +0200 Subject: [PATCH] Let's not search in a map. --- server/TracyView.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 0d495f92..77325efd 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -6476,15 +6476,15 @@ static tracy_force_inline CallstackFrameTree* GetFrameTreeItem( std::vector View::GetCallstackFrameTree( const MemData& mem ) const { std::vector root; - flat_hash_map, nohash> paths; + std::vector> paths; + paths.resize( m_worker.GetCallstackPayloadCount() ); for( auto& ev : mem.data ) { if( ev.csAlloc == 0 ) continue; - auto it = paths.find( ev.csAlloc ); - if( it != paths.end() ) + auto& path = paths[ev.csAlloc]; + if( !path.empty() ) { - const auto& path = it->second; auto treePtr = &root; CallstackFrameTree* node = nullptr; for( auto& v : path ) @@ -6501,28 +6501,28 @@ std::vector View::GetCallstackFrameTree( const MemData& mem else { auto& cs = m_worker.GetCallstack( ev.csAlloc ); - std::vector path; + Vector path; path.reserve( cs.size() ); auto base = cs.back(); auto treePtr = GetFrameTreeItem( root, base ); treePtr->countInclusive++; treePtr->allocInclusive += ev.size; - path.emplace_back( uint32_t( treePtr - root.data() ) ); + path.push_back( uint32_t( treePtr - root.data() ) ); for( int i = int( cs.size() ) - 2; i >= 0; i-- ) { auto newTreePtr = GetFrameTreeItem( treePtr->children, cs[i] ); newTreePtr->countInclusive++; newTreePtr->allocInclusive += ev.size; - path.emplace_back( uint32_t( newTreePtr - treePtr->children.data() ) ); + path.push_back( uint32_t( newTreePtr - treePtr->children.data() ) ); treePtr = newTreePtr; } treePtr->countExclusive++; treePtr->allocExclusive += ev.size; - paths.emplace( ev.csAlloc, std::move( path ) ); + paths[ev.csAlloc] = std::move( path ); } } return root;