News for hackers. Stuff that matters.
Re:What I learned from others' shell scripts by unhammer on Wednesday August 14, 2013 @11:36AM (#6212114)
By the way,

> "cat myfile | grep foo | awk '...'" […] indeed this is one of the most frequent performance sinks in shell scripts

Is it really? I would've thought loops were a more common performance sink. I can't imagine how that useless use of cat has _that_ much of an effect, unless you're running a whole bunch of copies of this script. It looks ugly in the process table and it does not let the real command (here: grep) move back and forth in the file, but I've never noticed performance improvements from removing uuoc's.

Re:What I learned from others' shell scripts by jzwinck on Friday August 16, 2013 @07:52AM (#6223387)
My original phrasing may have been unclear; with the elision you made the thrust becomes quite different. I intended to convey two thoughts: that Useless Use of Cat and other filters is pervasive because it is so easy, and secondly, that spawning tons of unnecessary processes is a common performance waste. The specific example with just three processes (cat, grep, awk) is not such a big deal--the bad cases are when stuff like that happens within loops (but the performance loss is not due to the loops, but rather the spawning).
Re:What I learned from others' shell scripts by e12e on Thursday August 15, 2013 @06:26AM (#6217008)
To be fair, there's (probably) two forks too many: awk can do filtering on regular expressions too.

Not that I think it really makes much of difference in most cases.