mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-25 23:44:35 +00:00
Replace stray std::sort() with pdqsort_branchless().
This commit is contained in:
parent
717605065a
commit
d400183483
@ -8,6 +8,7 @@
|
||||
#include "TracyFileselector.hpp"
|
||||
#include "TracyPrint.hpp"
|
||||
#include "TracyView.hpp"
|
||||
#include "tracy_pdqsort.h"
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
@ -400,9 +401,9 @@ void View::DrawCompare()
|
||||
}
|
||||
}
|
||||
|
||||
std::sort( m_compare.thisUnique.begin(), m_compare.thisUnique.end(), []( const auto& lhs, const auto& rhs ) { return strcmp( lhs, rhs ) < 0; } );
|
||||
std::sort( m_compare.secondUnique.begin(), m_compare.secondUnique.end(), []( const auto& lhs, const auto& rhs ) { return strcmp( lhs, rhs ) < 0; } );
|
||||
std::sort( m_compare.diffs.begin(), m_compare.diffs.end(), []( const auto& lhs, const auto& rhs ) { return strcmp( lhs.first, rhs.first ) < 0; } );
|
||||
pdqsort_branchless( m_compare.thisUnique.begin(), m_compare.thisUnique.end(), []( const auto& lhs, const auto& rhs ) { return strcmp( lhs, rhs ) < 0; } );
|
||||
pdqsort_branchless( m_compare.secondUnique.begin(), m_compare.secondUnique.end(), []( const auto& lhs, const auto& rhs ) { return strcmp( lhs, rhs ) < 0; } );
|
||||
pdqsort_branchless( m_compare.diffs.begin(), m_compare.diffs.end(), []( const auto& lhs, const auto& rhs ) { return strcmp( lhs.first, rhs.first ) < 0; } );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "TracyPrint.hpp"
|
||||
#include "TracyVector.hpp"
|
||||
#include "TracyView.hpp"
|
||||
#include "tracy_pdqsort.h"
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
@ -147,7 +148,7 @@ static void BuildFlameGraph( const Worker& worker, Vector<FlameGraphItem>& data,
|
||||
|
||||
static void SortFlameGraph( Vector<FlameGraphItem>& data )
|
||||
{
|
||||
std::sort( data.begin(), data.end(), []( const FlameGraphItem& lhs, const FlameGraphItem& rhs ) { return lhs.time > rhs.time; } );
|
||||
pdqsort_branchless( data.begin(), data.end(), []( const FlameGraphItem& lhs, const FlameGraphItem& rhs ) { return lhs.time > rhs.time; } );
|
||||
for( auto& v : data ) SortFlameGraph( v.children );
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "TracyTimelineItemGpu.hpp"
|
||||
#include "TracyUtility.hpp"
|
||||
#include "TracyView.hpp"
|
||||
#include "tracy_pdqsort.h"
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
@ -194,7 +195,7 @@ void View::DrawOptions()
|
||||
}
|
||||
while( idx < NumSlopes );
|
||||
}
|
||||
std::sort( slopes, slopes+NumSlopes );
|
||||
pdqsort_branchless( slopes, slopes+NumSlopes );
|
||||
drift = int( 1000000000 * -slopes[NumSlopes/2] );
|
||||
}
|
||||
}
|
||||
@ -674,7 +675,7 @@ void View::DrawOptions()
|
||||
ImGui::SameLine();
|
||||
if( ImGui::SmallButton( "Sort" ) )
|
||||
{
|
||||
std::sort( m_threadOrder.begin(), m_threadOrder.end(), [this] ( const auto& lhs, const auto& rhs ) {
|
||||
pdqsort_branchless( m_threadOrder.begin(), m_threadOrder.end(), [this] ( const auto& lhs, const auto& rhs ) {
|
||||
if( lhs->groupHint != rhs->groupHint ) return lhs->groupHint < rhs->groupHint;
|
||||
return strcmp( m_worker.GetThreadName( lhs->id ), m_worker.GetThreadName( rhs->id ) ) < 0;
|
||||
} );
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "TracyImGui.hpp"
|
||||
#include "TracyPrint.hpp"
|
||||
#include "TracyView.hpp"
|
||||
#include "tracy_pdqsort.h"
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
@ -487,7 +488,7 @@ void View::DrawStatistics()
|
||||
{
|
||||
imgNames.emplace_back( m_worker.GetString( img ) );
|
||||
}
|
||||
std::sort( imgNames.begin(), imgNames.end(), [] ( const auto& lhs, const auto& rhs ) { return strcmp( lhs, rhs ) < 0; } );
|
||||
pdqsort_branchless( imgNames.begin(), imgNames.end(), [] ( const auto& lhs, const auto& rhs ) { return strcmp( lhs, rhs ) < 0; } );
|
||||
for( auto& img : imgNames )
|
||||
{
|
||||
bool sel = false;
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "TracyImGui.hpp"
|
||||
#include "TracyPrint.hpp"
|
||||
#include "TracyView.hpp"
|
||||
#include "tracy_pdqsort.h"
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
@ -752,7 +753,7 @@ void View::DrawInfo()
|
||||
std::vector<decltype(topology.begin())> tsort;
|
||||
tsort.reserve( topology.size() );
|
||||
for( auto it = topology.begin(); it != topology.end(); ++it ) tsort.emplace_back( it );
|
||||
std::sort( tsort.begin(), tsort.end(), [] ( const auto& l, const auto& r ) { return l->first < r->first; } );
|
||||
pdqsort_branchless( tsort.begin(), tsort.end(), [] ( const auto& l, const auto& r ) { return l->first < r->first; } );
|
||||
for( auto& package : tsort )
|
||||
{
|
||||
if( package->first != 0 ) dpos.y += ty;
|
||||
@ -763,7 +764,7 @@ void View::DrawInfo()
|
||||
std::vector<decltype(package->second.begin())> dsort;
|
||||
dsort.reserve( package->second.size() );
|
||||
for( auto it = package->second.begin(); it != package->second.end(); ++it ) dsort.emplace_back( it );
|
||||
std::sort( dsort.begin(), dsort.end(), [] ( const auto& l, const auto& r ) { return l->first < r->first; } );
|
||||
pdqsort_branchless( dsort.begin(), dsort.end(), [] ( const auto& l, const auto& r ) { return l->first < r->first; } );
|
||||
for( auto& die : dsort )
|
||||
{
|
||||
dpos.y += small;
|
||||
@ -786,7 +787,7 @@ void View::DrawInfo()
|
||||
std::vector<decltype(die->second.begin())> csort;
|
||||
csort.reserve( die->second.size() );
|
||||
for( auto it = die->second.begin(); it != die->second.end(); ++it ) csort.emplace_back( it );
|
||||
std::sort( csort.begin(), csort.end(), [] ( const auto& l, const auto& r ) { return l->first < r->first; } );
|
||||
pdqsort_branchless( csort.begin(), csort.end(), [] ( const auto& l, const auto& r ) { return l->first < r->first; } );
|
||||
auto cpos = dpos + ImVec2( margin, margin );
|
||||
int ll = cpl;
|
||||
for( auto& core : csort )
|
||||
|
Loading…
Reference in New Issue
Block a user