Re:/usr/bin/time: not the command you think you know
by jstimpfle on Tuesday March 07, 2017 @04:10AM
(#13809189)
That is merely an optimization though. You can simply
[ Parent
| on HN ]
Re:/usr/bin/time: not the command you think you know
by therein on Tuesday March 07, 2017 @04:35AM
(#13809273)
But now you are timing the startup of `sh` as well.
Re:/usr/bin/time: not the command you think you know
by aexaey on Tuesday March 07, 2017 @06:50AM
(#13809711)
...which (surprisingly) is a measurable amount. About 1 ms for `dash` and a whooping 9.5 ms for `bash` on a relatively slow CPU:
pi@pi:~ $ time (for x in {1..1000}; do time echo | sleep 0.01; done 2>/dev/null)
real 0m24.173s
pi@pi:~ $ time (for x in {1..1000}; do time sh -c 'echo | sleep 0.01'; done 2>/dev/null)
real 0m25.170s
pi@pi:~ $ time (for x in {1..1000}; do time bash -c 'echo | sleep 0.01'; done 2>/dev/null)
real 0m33.643s
Re:/usr/bin/time: not the command you think you know
by jstimpfle on Tuesday March 07, 2017 @11:50AM
(#13811946)
1ms is on the order of process creation time, so not very relevant: The measured program itself requires process creation. Most programs run considerably longer than that (otherwise timing would not make much sense).
It's really not more than that: an optimization.