From our experience, ksh is generally faster, and dash sits between ksh and bash. One reason is that dash stores variables using a very small hash table with only 37 entries[0] meaning variable access quickly becomes linear as memory usage grows. But even with that, dash is still surprisingly fast -- when compiling `pnut.c` with `pnut.sh`, dash comes in second place:
For me `dash` compiles in just a few seconds. If you link to a 1-line problem (here, #define VTABSIZE 39), then why not boost that to 79 or 113, say, re-compile the shell and re-run your benchmark? Might lead to a change in upstream that could benefit everyone.
There was an effort to (re)start ksh93 development, but AT&T halted this effort. The bugfixes from the failed effort have moved back into Korn's last release.
On rhel9, this is a list of my installed shells. You might notice that dash is smaller than ls (and the rest of the shells).
$ ll /bin/bash /bin/dash /bin/ksh93 /bin/ls /bin/mksh
-rwxr-xr-x. 1 root root 1389064 May 1 00:59 /bin/bash
-rwxr-xr-x. 1 root root 128608 May 9 2023 /bin/dash
-rwxr-xr-x. 1 root root 1414912 Apr 9 07:26 /bin/ksh93
-rwxr-xr-x. 1 root root 140920 Apr 8 08:20 /bin/ls
-rwxr-xr-x. 1 root root 325208 Jan 9 2022 /bin/mksh
$ rpm -qi dash | tail -4
Description :
DASH is a POSIX-compliant implementation of /bin/sh that aims to be as small as
possible. It does this without sacrificing speed where possible. In fact, it is
significantly faster than bash (the GNU Bourne-Again SHell) for most tasks.
EDIT: ksh93, not ksh