1,141 karma · joined September 12, 2008
Some extra notes...
Accurate (cgroup aware) nproc is important, as detailed in: https://danluu.com/cgroup-throttling/
The new base58 encoding performs well being around 500 times faster than arbitrary int implementation internal to cpython 3.13 for example
It's also worth mentioning a recent improvement we made (in coreutils 8.28) to the operation of the `tail | grep` example in the article. tail now notices if the pipe goes away, so one could wait for something to appear in a log, like:
tail -f /log/file | grep -q match
then_do_something
There are lots of gotchas to pipe handling really.
See also: https://www.pixelbeat.org/programming/sigpipe_handling.htmluutils uses the coreutils test suite, so it makes sense to add a test case for that, which uutils will eventually get to. I'll do that now.
slow path:
seq -f '%.1f' inf | pv > /dev/null
...[ 12MiB/s]
fast path: seq inf | pv > /dev/null
...[ 491MiB/s]The commit that sped up GNU yes has a summary of the perf measurements: https://github.com/coreutils/coreutils/commit/3521722
yes can be used to generate arbitrary repeated data for testing or whatever, so it is useful to be fast
I've some general notes on SIGPIPE mishandling at http://www.pixelbeat.org/programming/sigpipe_handling.html
It's also worth noting the separate "progress" project which can be used to give the progress of running file based utilities.
We generally have pushed back on adding progress to each of the coreutils for these reasons, but the low overhead of implementation and high overlap with existing options was deemed enough to warrant adding this to dd
It comes from the DD (data definition) statement of OS/360 JCL, and hence why dd has the unusual option syntax compared to other unix utils
BTW if you are using dd to write usb drives etc. it's useful to bypass the Linux VM as much as possible to avoid systems stalls, especially with slow devices. You can do that with O_DIRECT. Also dd recently got a progress option, so...
dd bs=2M if=disk.img of=/dev/sda... status=progress iflag=direct oflag=direct
Note dd is a lower level tool, which is why there are some gotchas when using for higher level operations. I've noted a few at:Interesting info wrt efficient unicode processing for \w and -i.
cheers
I find this simple wrapper around grep(1) very fast and useful:
Generally the GNU project maintainers are not paid by the FSF. Mostly they're paid through the likes of Red Hat etc., with varying overlap between day job and maintainership
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob;f=confi...
The core of the duplicate detection is the shell script here:
https://github.com/pixelb/fslint/blob/ffcd3b85/fslint/findup...