Re: [HEADSUP] making /bin/sh the default shell for root

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Thu, 23 Sep 2021 03:55:12 UTC
grarpamp <grarpamp@gmail.com> writes:

> BSD community can definitely volunteer to make benchmark of
> its shell vs others, determine if and where improvements to make.
> Many apps never get checked for obvious speedups,
> if so it might become fastest shell even with the new features.

Like https://github.com/shellspec/shellbench ?
I did check a month ago (on 2021-08-31) but forgot NetBSD sh(1).
Obviously, the results may vary per OS/version/architecture/hardware.

$ ./shellbench -s sh,dash,busybox/sh,bash,zsh,oksh,ksh93,yash sample/*.sh
----------------------------------------------------------------------------------------------------------------------
name                                   sh       dash busybox/sh       bash        zsh       oksh      ksh93       yash
----------------------------------------------------------------------------------------------------------------------
assign.sh: positional params    1,983,164    747,830    666,979    443,083    551,071    875,915    479,129    395,225
assign.sh: variable             2,405,745    827,904    741,112    616,017  1,308,457  1,013,153    588,698    510,636
assign.sh: local var            2,398,554    834,027    747,871    603,486  1,293,027  1,007,511      error    503,410
assign.sh: local var (typeset)      error      error      error    616,483  1,306,641  1,011,383    544,136    504,782
cmp.sh: [ ]                     1,628,216    567,700    465,761    352,438    336,288    713,738    518,768    297,987
cmp.sh: [[ ]]                       error      error      error    480,974    595,441    903,502    613,269    376,550
cmp.sh: case                    2,527,633  1,196,339  1,024,253    606,588    632,811    959,232    628,183    450,893
count.sh: posix                 1,640,683    717,178    589,330    463,934    907,140    700,233    376,361    398,937
count.sh: typeset -i                error      error      error    452,029    907,541    652,885    385,585      error
count.sh: increment                 error      error      error    581,631  1,264,962    845,738    581,111      error
eval.sh: direct assign          1,670,797    564,299    518,082    308,709    198,714    722,050    285,150    279,020
eval.sh: eval assign            1,102,774    393,161    332,925    194,636    156,834    476,164    173,156    192,191
eval.sh: command subs               2,188      5,828      4,830      2,208      1,597      5,015          ?      4,302
func.sh: no func                2,451,641    836,115    756,258    614,579    711,116  1,087,770    571,210    507,644
func.sh: func                   1,947,254    596,731    542,519    349,748    187,903    845,681    306,506    313,989
null.sh: blank                  3,094,116      error      error      error  1,529,326  1,304,367      error    593,711
null.sh: assign variable        2,419,811    845,676    751,887    669,694  1,374,858  1,012,724    599,490    533,401
null.sh: define function        2,687,933  1,259,149  1,076,947    661,432  1,270,777  1,085,654    584,490    525,184
null.sh: undefined variable     2,445,429    839,334    750,904    505,147    631,862  1,048,805    473,900    501,851
null.sh: : command              2,418,617    839,744    742,385    610,307    701,972  1,064,089    565,323    500,879
output.sh: echo                 1,518,368    669,539    620,417    404,729    544,030    781,488    540,064    380,174
output.sh: printf               1,481,745    632,454    535,170    395,649    534,303      1,556    258,827    365,724
output.sh: print                    error      error      error      error    542,740    775,812    353,320      error
subshell.sh: no subshell        2,330,179    819,359    729,753    571,353    705,892  1,005,262    560,780    485,498
subshell.sh: brace              2,343,747    833,142    728,803    554,948    568,470    984,156    557,069    413,438
subshell.sh: subshell               3,444      6,917      2,814      1,190      3,578      3,391    240,738      2,570
subshell.sh: command subs       1,871,462      3,806      5,966      2,766      2,709      4,564    146,388      3,691
subshell.sh: external command       1,112        996        579        893      2,190      2,529      1,728      1,778
----------------------------------------------------------------------------------------------------------------------
* count: number of executions per second