6 ms·
> I am measuring the performance of equivalent cat <file> | sort | uniq -c | sort -n functionality. It likely won’t matter much here, but invoking cat is unnec
by Someone 1y ago
> I am measuring the performance of equivalent cat <file> | sort | uniq -c | sort -n functionality.
It likely won’t matter much here, but invoking cat is unnecessary.
sort <file> | uniq -c | sort -n
will do the job just fine. GNU’s sort also has a few flags controlling buffer size and parallelism. Those may matter more (see https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html#sort-invocation https://www.gnu.org/software/coreutils/manual/html_node/sort...)
- deleted 1y ago[deleted]
- noamteyssier 1y agoThanks for sharing! You're right that the `cat` is unnecessary - and removing it actually had some marginal gains to the naive solution. I've updated the benchmarks to show this Cheers