4 ms·
There are some interesting assertions in this article. "bash and zsh are fairly fast" - the manual page for bash (confirmed up to v5.1.8) contains "It's too bi
by chasil 3y ago
There are some interesting assertions in this article.
"bash and zsh are fairly fast" - the manual page for bash (confirmed up to v5.1.8) contains "It's too big and too slow" under the BUGS section near the end of the document. The dash shell is rumored to be 4x as fast as bash for many uses.
"Both ksh and dash are too bare-bones for me to want to use them as an interactive shell" - dash can actually be compiled with full editing of the command line, but is rarely prepared in this way. While dash omits almost all features that are not in the POSIX standards, it can in fact be used well as a standards-compliant interactive shell. The Korn shell also has a much larger feature set and is the default interactive shell on commercial UNIX; the last version released by David Korn has vastly more capability and features than bash.
"exec fish" - this is a bit dangerous, in that a mistake will prevent an interactive login. To fix such a case, use SFTP to push corrections. If you really like fish, ensure that it's added to the /etc/shells file, then use the chsh command to make it your login shell.
- chaps 3y agoSadly, ksh is not updated anymore AFAIK.
- chasil 3y agoDavid Korn's ksh93 was passed on to a new set of developers, who attempted to release a new version; AT&T rolled back these changes due to performance problems which raised questions of support status. It does appear that ksh93 development has resumed, and a new version was released late last year. https://github.com/ksh93/ksh/releases https://github.com/ksh93/ksh/releases The independent pdksh spawned mksh, which is the default shell used in Android (as it has a BSD license); mksh appears to be very much active. http://www.mirbsd.org/mksh.htm http://www.mirbsd.org/mksh.htm [https site has cert problems] OpenBSD also forked oksh from pdksh. This is certainly well-maintained. https://github.com/ibara/oksh https://github.com/ibara/oksh
- kps 3y agoMy recollection is that someone adopted the ksh93 tree and started making incompatible changes, which were picked up by some distributions (Debian I know) and broke things. I use ksh93 as my primary shell, interactively and for personal scripts. For scripting, a killer feature is the declarative `getopts` that makes it trivial for even the quickest dirtiest script to have full command line option handling including help.
- jmclnx 3y agoSomeone in the arch community did benchmarks on many shells a year or 2 ago. It was very well written. The end result was ksh93 was the fastest. I really wish I had the link, but I lost it. I have looked for it many times but without luck. Looking again but I doubt I will find it. If I do I will update this post. I believe this is the link, but I cannot get to it due to some cloud ways error. https://forum.archlabslinux.com/t/interactive-shells-a-comparison/2691 https://forum.archlabslinux.com/t/interactive-shells-a-compa...
- theamk 3y agoThat "too big and slow" comment in bash manpage is very out of date. For example I've did a local test and "bash" is about 4x slower than "dash".. but still only 1.5 ms, and that would be certainly be fast enough for most applications.
- chasil 3y agoYou might submit that as a pull request, assuming so.
- arp242 3y ago> The dash shell is rumored to be 4x as fast as bash for many uses. That seems a lot, and sounds like those rumours are exactly that. When Debian switched from bash to dash as /bin/sh they saved about 5% on boot time (pre-systemd) on a slow EEE "netbook" thingy. Maybe there are some specific usage patterns that give a 4x speed-up? I don't know. That doesn't seem to be the common case though. That "it's too big and slow" message has been there since at least 1996 by the way, the first entry in git ("Imported from ../bash-1.14.7.tar.gz").
- chasil 3y agoSorry, you are incorrect. "The Dash shell is roughly 2-5 times more efficient than the Bash shell in terms of execution speed." https://www.baeldung.com/linux/dash-vs-bash-performance https://www.baeldung.com/linux/dash-vs-bash-performance This is a top google search result, by no means difficult to find.
- arp242 3y agoIt's not incorrect as that was what was observed. It's a real-world use case. Some artificial benchmarks doesn't automatically translate to "4x as fast as bash for many uses". Things like "500k variable assignments per second" vs. "1.8M variable assignments per second" is an insignificant and unmeasurable difference for most real-world scripts because they have dozens, hundreds, or perhaps thousands of assignments. Not millions. For most scripts the majority of time is spent launching binaries and doing whatever that external binary is doing.