[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 0/4] faster gnulib-tool
From: |
Pádraig Brady |
Subject: |
Re: [PATCH 0/4] faster gnulib-tool |
Date: |
Fri, 2 Jan 2009 11:11:22 +0000 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
Paolo Bonzini wrote:
>
> A while ago I made a lot of timings regarding the speed of various shell
> constructs; you can find them on the Autoconf list. Here are the
> relevant ones:
>
> $ time sh -c 'for i in `seq 1 1000`; do :; done'
> user 0m0.034s
> sys 0m0.024s
>
> $ time sh -c 'for i in `seq 1 1000`; do (:); done'
> user 0m0.486s
> sys 0m2.377s
>
> $ time sh -c 'for i in `seq 1 1000`; do echo abc | :; done'
> user 0m0.958s
> sys 0m4.657s
>
> echo and : are shell builtins, but they fork, so they're slow. s/:/sed/
> and you see my point.
>
> If this 10x-30x improvement affected 20% of the shell execution time,
> one could expect a decent speedup.
>
> That would probably amount to a rewrite of bash, dash, or whatever else.
> You would have to make the main shell loop centered around
> event-driven processing of file descriptors, to provide all the pipes
> with a single process.
>
> A fun project, but probably not one that I or anyone else will attempt
> without funding. :-)
Nice info thanks.
I tested stuff like this previously, and found it highly shell dependent:
http://www.pixelbeat.org/programming/shell_script_mistakes.html#performance
In summary I noticed that dash forked twice as fast as bash,
and dash's base looping speed was 6 times faster.
cheers,
Pádraig.