Cache bin containers in find zone.

This commit is contained in:
Bartosz Taudul 2018-06-06 23:06:00 +02:00
parent 2950f3c70c
commit da5d35c364
2 changed files with 14 additions and 5 deletions

View File

@ -3425,13 +3425,20 @@ void View::DrawFindZone()
const auto numBins = int64_t( w - 4 );
if( numBins > 1 )
{
auto bins = std::make_unique<int64_t[]>( numBins );
if( numBins != m_findZone.numBins )
{
m_findZone.numBins = numBins;
m_findZone.bins = std::make_unique<int64_t[]>( numBins );
m_findZone.binTime = std::make_unique<int64_t[]>( numBins );
m_findZone.selBin = std::make_unique<int64_t[]>( numBins );
}
const auto& bins = m_findZone.bins;
const auto& binTime = m_findZone.binTime;
const auto& selBin = m_findZone.selBin;
memset( bins.get(), 0, sizeof( int64_t ) * numBins );
auto binTime = std::make_unique<int64_t[]>( numBins );
memset( binTime.get(), 0, sizeof( int64_t ) * numBins );
auto selBin = std::make_unique<int64_t[]>( numBins );
memset( selBin.get(), 0, sizeof( int64_t ) * numBins );
int64_t selBinTime = 0;

View File

@ -211,6 +211,8 @@ private:
bool showThreads = true;
bool sortByCounts = false;
Region highlight;
int64_t numBins = -1;
std::unique_ptr<int64_t[]> bins, binTime, selBin;
void Reset()
{