3 ms·
To quote the author > We call touch in the loop here (I do know that the code can be re-written with xargs, so that touch is called only once; but let’s forget
by paulddraper 10y ago
To quote the author
> We call touch in the loop here (I do know that the code can be re-written with xargs, so that touch is called only once; but let’s forget about it for now, okay?)...This means there is a new process for each file. This is extremely inefficient. Code in any other programming language will work faster than this one.
WHAT THE HELL??? Did he just criticize Unix/POSIX for its inefficiency after willfully choosing a less efficient way?
He wrote
find foo -print0 | while IFS="" read -rd "" A; do touch -- "$A"; done
When we could have written the very fast and very readable and very simple
find foo -print0 | xargs -0 touch --
I'll put this up against the equivalent implementation in any language you choose.