I'm going to agree with you here. 99% of the time this UUOC stuff is just premature optimization. If it gets the job done it does not matter if it wastes a few milliseconds.
cat somefile |while read line
do
echo $line|cat -|pipe...
done
Because otherwise I can't see how a pipeline would be started for each line of a datafile ? for f in *;
do
cat $f | ...
done
Now make that a directory with thousands of files or a script digs down through through the tree. exec 5<words.txt
while read line <&5 ; do
echo "line read: $line"
done
exec <&5-(2) Be careful about load averages, lots of people don't understand them. It just means the number of processes ready to run over a period of time. It is entirely possible to have a very high load average with a very low cpu utilization. A bunch of little processes that hop on and off the run queue really quickly because they only have a little bit of work to do at a time can kick the load average up way higher than a single self-contained process doing the same amount of work with the same amount of total cpu utilization. The single process wins on context switches, but modern cpus cache those in hardware so its barely a win any more.