Pádraig Brady <[email protected]> writes:
> On 21/02/2026 08:24, Collin Funk wrote:
>> Here is the throughput before this patch:
>> # write_permuted_numbers
>> $ ./src/shuf-prev -i 0-100000000 | pv -r > /dev/null
>> [ 153MiB/s]
>> # write_random_numbers
>> $ timeout 10 ./src/shuf-prev -i 0-100000 -r | pv -r > /dev/null
>> [78.6MiB/s]
>> Here is the throughput after this patch:
>> # write_permuted_numbers
>> $ timeout 10 ./src/shuf -i 0-100000000 | pv -r > /dev/null
>> [ 308MiB/s]
>> # write_random_numbers
>> $ timeout 10 ./src/shuf -i 0-100000 -r | pv -r > /dev/null
>> [ 196MiB/s]
>
> Oh wow. Nice.
> The 2x improvement definitely warrants a mention in NEWS.
Agreed, I forgot to write it. I pushed the patch with a NEWS entry added
[1].
I said "two times faster", since that seems to be accurate in the
majority of cases.
However, you can see larger performance improvement than that with
smaller numbers, since a larger proportion of the execution time will be
spent trying to lock standard output versus converting/printing:
$ timeout 60 ./src/shuf-prev -i 0-1 -r | pv -r > /dev/null
[29.8MiB/s]
$ timeout 60 ./src/shuf -i 0-1 -r | pv -r > /dev/null
[ 110MiB/s]
Collin
[1]
https://github.com/coreutils/coreutils/commit/89735ea830b293d50a9323770d6089bac7324aab