mirror of
https://github.com/wolfpld/tracy.git
synced 2026-08-06 21:39:22 +00:00
Do not mark sorted vectors as unsorted on equal elements.
SortedVector considered an appended element equal to the last one to break the ordering, marking the vector as unsorted. A non-decreasing sequence is sorted, so only a strictly smaller element has to trigger the marker. Equal keys are common: child sample vectors receive identical timestamps whenever a recursive call stack contains the same call site twice, which flipped the vectors to unsorted on virtually every recursive workload and caused the lazy sort in GetChildSamples to run over and over again while holding the data lock. The lazy sort machinery handles duplicate keys correctly, as both the prefix and tail merge windows are computed with lower bounds.
This commit is contained in:
@@ -72,7 +72,7 @@ public:
|
||||
template<class Compare>
|
||||
tracy_force_inline void push_back( const T& val, Compare comp )
|
||||
{
|
||||
if( sortedEnd == 0 && !v.empty() && !comp( v.back(), val ) )
|
||||
if( sortedEnd == 0 && !v.empty() && comp( val, v.back() ) )
|
||||
{
|
||||
sortedEnd = (uint32_t)v.size();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user