zsh: zargs
Let me show the power of zargs. First of all let’s see wheter both commands do the same:
$ find /usr/include -name \*.h -exec grep printf /dev/null {} \; | wc -l 389 $ zargs /usr/include/**/*.h -- grep printf /dev/null | wc -l 389
Yes, seems so – so let’s compare them via ‘time’:
$ time ( find /usr/include -name \*.h -exec grep printf /dev/null >| /dev/null {} \; ) Real: 4,89s User: 1,41s System: 3,46s CPU-percent: 99% $ time ( zargs /usr/include/**/*.h -- grep printf /dev/null >| /dev/null ) Real: 0,27s User: 0,14s System: 0,14s CPU-percent: 102%
July 27th, 2004 at 00:46
So if you use zsh on Gentoo will the numbers then decrease again? Looks quite impressive.
July 27th, 2004 at 00:52
Taking a look at my centericq-history shows me that you’re planning to install Gentoo on your 31337 ‘Acer Travelmate 8004LMi’ notebook. So this might be something for you – yes.
July 27th, 2004 at 13:02
102% CPU?
July 27th, 2004 at 18:49
I was using:
TIMEFMT=”Real: %E User: %U System: %S CPU-percent: %P”
The CPU percentage is computed as (CPU seconds spent in user mode + CPU seconds spent in kernel mode)/(elapsed time in seconds)
Now just calculate it with an example:
$ echo ‘scale=2; (0.14+0.12)/0.25’ | bc -l
1.04
For more details refer to the implementation in zsh: in function printtime [lines 535-539] in jobs.c (current zsh-version).