Sort plot data only when needed (i.e. to draw).

This commit is contained in:
Bartosz Taudul 2021-11-14 13:01:27 +01:00
parent 68d2812e82
commit b978a7c652
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3
3 changed files with 10 additions and 3 deletions

View File

@ -6600,7 +6600,8 @@ int View::DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover, fl
auto yPos = wpos.y + offset;
if( yPos + PlotHeight >= yMin && yPos <= yMax )
{
const auto& vec = v->data;
auto& vec = v->data;
if( !vec.is_sorted() ) vec.sort();
if( v->type == PlotType::Memory )
{

View File

@ -4295,13 +4295,18 @@ void Worker::HandleFrameName( uint64_t name, const char* str, size_t sz )
} );
}
void Worker::DoPostponedWork()
void Worker::DoPostponedWorkAll()
{
DoPostponedWork();
for( auto& plot : m_data.plots.Data() )
{
if( !plot->data.is_sorted() ) plot->data.sort();
}
}
void Worker::DoPostponedWork()
{
#ifndef TRACY_NO_STATISTICS
if( m_data.newFramesWereReceived )
{
@ -7651,7 +7656,7 @@ static void WriteHwSampleVec( FileWrite& f, SortedVector<Int48, Int48Sort>& vec
void Worker::Write( FileWrite& f, bool fiDict )
{
DoPostponedWork();
DoPostponedWorkAll();
f.Write( FileHeader, sizeof( FileHeader ) );

View File

@ -624,6 +624,7 @@ public:
std::pair<uint64_t, uint64_t> GetTextureCompressionBytes() const { return std::make_pair( m_texcomp.GetInputBytesCount(), m_texcomp.GetOutputBytesCount() ); }
void DoPostponedWork();
void DoPostponedWorkAll();
private:
void Network();