|
From: | Ole Tange |
Subject: | bug#20029: 'yes' surprisingly slow |
Date: | Sat, 7 Mar 2015 12:49:10 +0100 |
These two commands give the same output: $ yes `echo {1..1000}` | head -c 2300M | md5sum a0241f2247e9a37db60e7def3e4f7038 - $ yes "`echo {1..1000}`" | head -c 2300M | md5sum a0241f2247e9a37db60e7def3e4f7038 - But the time to run is quite different: $ time yes "`echo {1..1000}`" | head -c 2300M >/dev/null real 0m0.897s user 0m0.384s sys 0m1.343s $ time yes `echo {1..1000}` | head -c 2300M >/dev/null real 0m11.352s user 0m10.571s sys 0m2.590s WTF?! I imagine 'yes' spends a lot of time collecting the 1000 args. But why does it do that more than once? /Ole
[Prev in Thread] | Current Thread | [Next in Thread] |