From d64f0390da123e74aa61c968dcfd92dc6a8e5999 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 29 Apr 2018 01:23:30 +0200 Subject: [PATCH] Don't use std::sort. --- server/TracyWorker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index f34e1f8d..001441c7 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -545,7 +545,7 @@ Worker::Worker( FileRead& f, EventType::Type eventMask ) f.Read( &m_data.memory.low, sizeof( m_data.memory.low ) ); f.Read( &m_data.memory.usage, sizeof( m_data.memory.usage ) ); - std::sort( frees.begin(), frees.end(), [] ( const auto& lhs, const auto& rhs ) { return lhs.first < rhs.first; } ); + pdqsort_branchless( frees.begin(), frees.end(), [] ( const auto& lhs, const auto& rhs ) { return lhs.first < rhs.first; } ); const auto psz = m_data.memory.data.size() + frees.size() + 1; PlotData* plot = m_slab.AllocInit(); @@ -1355,7 +1355,7 @@ void Worker::HandlePostponedPlots() if( src.empty() ) continue; if( std::chrono::duration_cast( std::chrono::high_resolution_clock::now().time_since_epoch() ).count() - plot->postponeTime < 100 ) continue; auto& dst = plot->data; - std::sort( src.begin(), src.end(), [] ( const auto& l, const auto& r ) { return l.time < r.time; } ); + pdqsort_branchless( src.begin(), src.end(), [] ( const auto& l, const auto& r ) { return l.time < r.time; } ); const auto ds = std::lower_bound( dst.begin(), dst.end(), src.front().time, [] ( const auto& l, const auto& r ) { return l.time < r; } ); const auto dsd = std::distance( dst.begin(), ds ) ; const auto de = std::lower_bound( ds, dst.end(), src.back().time, [] ( const auto& l, const auto& r ) { return l.time < r; } );