mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-14 04:01:48 +00:00
Don't recalculate histogram bins every frame.
This remedies slowdown that was only visible when a histogram of a large number of zones (~100 million) was displayed. The slowdown was caused by std::accumulate() calls over whole set of zones.
This commit is contained in:
parent
14398dd4e8
commit
d683699ba9
@ -6313,12 +6313,23 @@ void View::DrawFindZone()
|
|||||||
m_findZone.bins = std::make_unique<int64_t[]>( numBins );
|
m_findZone.bins = std::make_unique<int64_t[]>( numBins );
|
||||||
m_findZone.binTime = std::make_unique<int64_t[]>( numBins );
|
m_findZone.binTime = std::make_unique<int64_t[]>( numBins );
|
||||||
m_findZone.selBin = std::make_unique<int64_t[]>( numBins );
|
m_findZone.selBin = std::make_unique<int64_t[]>( numBins );
|
||||||
|
m_findZone.binCache.numBins = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& bins = m_findZone.bins;
|
const auto& bins = m_findZone.bins;
|
||||||
const auto& binTime = m_findZone.binTime;
|
const auto& binTime = m_findZone.binTime;
|
||||||
const auto& selBin = m_findZone.selBin;
|
const auto& selBin = m_findZone.selBin;
|
||||||
|
|
||||||
|
const auto distBegin = std::distance( sorted.begin(), sortedBegin );
|
||||||
|
const auto distEnd = std::distance( sorted.begin(), sortedEnd );
|
||||||
|
if( m_findZone.binCache.numBins != numBins ||
|
||||||
|
m_findZone.binCache.distBegin != distBegin ||
|
||||||
|
m_findZone.binCache.distEnd != distEnd )
|
||||||
|
{
|
||||||
|
m_findZone.binCache.numBins = numBins;
|
||||||
|
m_findZone.binCache.distBegin = distBegin;
|
||||||
|
m_findZone.binCache.distEnd = distEnd;
|
||||||
|
|
||||||
memset( bins.get(), 0, sizeof( int64_t ) * numBins );
|
memset( bins.get(), 0, sizeof( int64_t ) * numBins );
|
||||||
memset( binTime.get(), 0, sizeof( int64_t ) * numBins );
|
memset( binTime.get(), 0, sizeof( int64_t ) * numBins );
|
||||||
memset( selBin.get(), 0, sizeof( int64_t ) * numBins );
|
memset( selBin.get(), 0, sizeof( int64_t ) * numBins );
|
||||||
@ -6414,6 +6425,7 @@ void View::DrawFindZone()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int64_t maxVal;
|
int64_t maxVal;
|
||||||
if( cumulateTime )
|
if( cumulateTime )
|
||||||
|
@ -376,6 +376,13 @@ private:
|
|||||||
int selCs = 0;
|
int selCs = 0;
|
||||||
int minBinVal = 1;
|
int minBinVal = 1;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
int numBins = -1;
|
||||||
|
ptrdiff_t distBegin;
|
||||||
|
ptrdiff_t distEnd;
|
||||||
|
} binCache;
|
||||||
|
|
||||||
void Reset()
|
void Reset()
|
||||||
{
|
{
|
||||||
ResetMatch();
|
ResetMatch();
|
||||||
@ -411,6 +418,7 @@ private:
|
|||||||
selAverage = 0;
|
selAverage = 0;
|
||||||
selMedian = 0;
|
selMedian = 0;
|
||||||
selTotal = 0;
|
selTotal = 0;
|
||||||
|
binCache.numBins = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowZone( int32_t srcloc, const char* name )
|
void ShowZone( int32_t srcloc, const char* name )
|
||||||
|
Loading…
Reference in New Issue
Block a user