Adding to the front of a line
David Fox
dfox94085 at gmail.com
Wed Jan 21 05:38:47 UTC 2009
On Tue, Jan 20, 2009 at 3:37 AM, Florian Diesch <diesch at spamfence.net> wrote:
> Using "seq 1 1000000 " as input the shell codes needs about 18s here
> while sed needs about 7s.
I'm not sure that is a fair test. Sure, bash is interpreted, but how
much "interpretation" really is done by a simple 'seq 1 1000000'?
Probably not a whole lot, compared to something like a for/next loop
in the old interpreted Basic machines.
For instance, most of the time taken up by 'seq 1 1000000' from a bash
command line is the time taken up to display all those numbers. If I
do 'time seq 1 1000000' I get close to ~30 secs wall clock time, but
if I do 'time seq 1 1000000 >/dev/null' the time to do that is closer
to 1 second.
Doing "a=`seq 1 1000000` there is a short, but perceptible lag before
the shell prompt is returned, but it's very short.
More information about the ubuntu-users
mailing list