Parallelizing bootscripts [was: Make bootscripts more POSIX compliant]

Dan Nicholson dbn.lists at gmail.com
Tue Feb 20 13:55:56 PST 2007


On 2/20/07, Bruce Dubbs <bruce.dubbs at gmail.com> wrote:
> Dan Nicholson wrote:
> >
> > $ time { for (( i = 0; i < 20; i++ )); do /bin/bash -c ":"; done; }
> >
> > real    0m0.034s
> > user    0m0.014s
> > sys     0m0.020s
> > $ time { for (( i = 0; i < 20; i++ )); do /bin/dash -c ":"; done; }
> >
> > real    0m0.015s
> > user    0m0.004s
> > sys     0m0.011s
>
> OK, let's analyze this.  20 invocations.  19 ms difference.  Less than 1
> ms wall clock time per invocation.  How much time did you want to put in
> on this?  :)

Let's analyze it a different way. It takes over twice as long to
initialize and close a bash shell than a dash shell. Why do that when
you don't have to? It's a simple optimization.

> The memory space is generally not significant either because only one
> copy of the code is in memory at any time.  The difference would be data
> space.

It's not the amount of memory that's the problem. But you're
constantly loading and unloading 6 times as much memory. I'd say that
accounts for the difference above.

The overhead is the same reason why people are adamant about coding in
C after all these years despite the availability of more powerful and
intuitive languages.

--
Dan



More information about the lfs-dev mailing list