From 5c5af7c1e56d96201aef2d7b40671a931615f4a8 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Wed, 4 Feb 2026 06:49:01 +0100 Subject: [PATCH] Sort threads by ID after name The "sort" button for threads uses an unstable sort, so threads with the same name will shuffle around without ever stabilizing. Use `id` to sort after comparing the name. --- profiler/src/profiler/TracyView_Options.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/profiler/src/profiler/TracyView_Options.cpp b/profiler/src/profiler/TracyView_Options.cpp index dd8256f1..d169f593 100644 --- a/profiler/src/profiler/TracyView_Options.cpp +++ b/profiler/src/profiler/TracyView_Options.cpp @@ -702,7 +702,9 @@ void View::DrawOptions() { 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; + const auto cmp = strcmp( m_worker.GetThreadName( lhs->id ), m_worker.GetThreadName( rhs->id ) ); + if( cmp != 0 ) return cmp < 0; + return lhs->id < rhs->id; } ); }