You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, criterion report entries are sorted using a simple codepoint-wise lexicographic string sort. This does not work well for benchmarks that cover a wide range of a numerical values for a certain parameter, such that numbers in benchmark/group names do not have the same number of digits.
For example, if I probe a parameter at values 1, 2, 4, 8, 16, criterion report entries will end up in this unpleasant order:
1
16
2
4
8
If would be nice if criterion could instead use a multi-digit number aware string sorting algorithm that conceptually splits strings into chunks of digits and non-digits, converts chunks of digits into integers, and then sorts the resulting (str, int, str, int...) tuples lexicographically. From memory, this is what the Windows file explorer does when sorting files by name.
In absence of a fix for this, criterion benchmarks can work around this criterion limitation by adding as many leading zeros as needed to numbers in benchmark names so that all numbers have the same number of digits. But this comes at the expense of slightly less readable benchmark names.
The text was updated successfully, but these errors were encountered:
Currently, criterion report entries are sorted using a simple codepoint-wise lexicographic string sort. This does not work well for benchmarks that cover a wide range of a numerical values for a certain parameter, such that numbers in benchmark/group names do not have the same number of digits.
For example, if I probe a parameter at values 1, 2, 4, 8, 16, criterion report entries will end up in this unpleasant order:
If would be nice if criterion could instead use a multi-digit number aware string sorting algorithm that conceptually splits strings into chunks of digits and non-digits, converts chunks of digits into integers, and then sorts the resulting (str, int, str, int...) tuples lexicographically. From memory, this is what the Windows file explorer does when sorting files by name.
In absence of a fix for this, criterion benchmarks can work around this criterion limitation by adding as many leading zeros as needed to numbers in benchmark names so that all numbers have the same number of digits. But this comes at the expense of slightly less readable benchmark names.
The text was updated successfully, but these errors were encountered: