[arch-general] dash as default shell?

Henry-Joseph Audéoud h.audeoud at gmail.com
Thu Jun 18 10:49:30 UTC 2020

On 17/06/2020 21:27, Piscium via arch-general wrote:
> The reasons Ubuntu switched in 2006 and Debian in 2011 were speed,
> less bugs and more security. A simple benchmark I ran with several
> shells using konsole (which is one of the fastest terminals according
> to my simple benchmarks):
> time ls -R /
> • dash 8.45
> • zsh 8.53 (1 % bigger)
> • bash 17.1
> • fish 19.55
> Times are in seconds, on my desktop that has a spinning drive. The
> first time it takes longer as the system caches stuff so the times
> above are after running a few times. I read that in some benchmarks
> dash is up to 4 times faster than bash.

I cannot understand the benchmark there.  If I run `bash -c "time ls -R 
/"` or `dash -c "time ls -R /"`, the only difference is the shell I 
started, and the way it reads commands and forks to launch time and/or 
ls, isn't it?  So I also can have the same test using `{bash,dash} -c 
"echo Hello World"`[1], isn't it?

I personnaly suspect that the output handling is responsible of that 
long execution time.  The konsole may be as fast as it can, it may still 
be a bottleneck as it has to print the (long) output of `ls -R`.  So I 
checked with /dev/null as output.  I also get rid of /proc (looping 
symlinks…) and /bin, /lib, /share… as clear symlinks of other points—but 
it should not change the result as we want to compare execution time.

# bash -c '/usr/bin/time ls -R 
# dash -c '/usr/bin/time ls -R 

After some warm-up executions to put objects in cache, both commands 
executes in 1.25 seconds on my computer.

[1] OK, precision of measure changes, we have to loop somewhere—but it 
is *how* it is measured, not *what* is measured, which is my problem.

Henry-Joseph Audéoud

More information about the arch-general mailing list