tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mksh import



On Thu, Dec 30, 2010 at 08:43:16AM -0500, Thor Lancelot Simon wrote:
>

> Another question is performance.  Some shells are much much faster than
> others for tasks like system builds.  For example, zsh can actually
> speed up the build considerably if used to replace our /bin/sh, while
> our in-tree "ksh" is about the same or a little slower.  How does mksh
> compare?

Well, for a very simple test of:

#!{shell}

/bin/echo -n
.
.
.
/bin/echo -n

with 5000 /bin/echo's, the results are a slower than both /bin/sh
and /bin/ksh.  Only a very little slower than /bin/ksh, though.

/bin/sh:

$ for i in $(jot 4); do time /tmp/perf.sh; done
    3.12s real     1.47s user     1.59s system
    3.09s real     1.52s user     1.54s system
    3.12s real     1.48s user     1.62s system
    3.09s real     1.48s user     1.55s system
    3.09s real     1.47s user     1.58s system

pdksh:

$ for i in $(jot 4); do time /tmp/perf.sh; done
    5.26s real     2.27s user     2.89s system
    5.24s real     2.29s user     2.86s system
    5.18s real     2.22s user     2.92s system
    5.21s real     2.20s user     2.93s system

mksh:

$ for i in $(jot 4); do time /tmp/perf.sh; done
    5.50s real     2.43s user     3.02s system
    5.51s real     2.39s user     3.07s system
    5.62s real     2.45s user     3.02s system
    5.54s real     2.41s user     3.07s system

zsh:

$ for i in $(jot 4); do time /tmp/perf.sh; done
    5.85s real     2.48s user     3.23s system
    5.68s real     2.48s user     3.19s system
    5.90s real     2.56s user     3.15s system
    5.81s real     2.56s user     3.21s system

This, of course, is not a very scientific benchmark but it does
suggest that the time it takes for fork/exec commands is a little
higher than ash, probably because it doesn't use vfork(2).  But,
it's also interesting to note that it is marginally slower than
pdksh as well.

I'd say that further investigation of the performance of mksh would
be warranted before we replace /bin/sh.  It may very well be faster
in a more representative workload.

--
    Roland Dowdeswell                      http://Imrryr.ORG/~elric/


Home | Main Index | Thread Index | Old Index