shuf: avoid locking standard output when using --input-range
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]
* NEWS: Mention the performance improvement.
* src/shuf.c (write_permuted_numbers, write_random_numbers): Prefer
fputs and fputc which may be unlocked over printf which locks standard
output.