3 ms·
I definitely notice a speed improvement with Dash. Most shell scripts are too small to notice a difference, but it made a big difference back before the switch
by klodolph 3y ago
I definitely notice a speed improvement with Dash. Most shell scripts are too small to notice a difference, but it made a big difference back before the switch to systemd, back when init was a bunch of clunky shell scripts.
- aidenn0 3y agoCheck your locale before benchmarking; setting it to "C" negates a lot of the dash performance advantage.
- chasil 3y agoDunno, the linked article looks like a conclusive performance advantage to me. Bash's own manual page concludes that "it's too big and too slow" in the BUGS section. https://www.baeldung.com/linux/dash-vs-bash-performance https://www.baeldung.com/linux/dash-vs-bash-performance
- JdeBP 3y agoFeel free to go and convince https://news.ycombinator.com/item?id=35987961 https://news.ycombinator.com/item?id=35987961, who isn't convinced by the actual measurements that people did. (-:
- aidenn0 3y agoFWIW on My Machine(tm) bash goes from ~4 times slower to ~70% slower on the simple startup test just by changing the locale: $ time for i in $(seq 1 1000); do bash -c ":" ; done real 0m4.475s user 0m3.234s sys 0m1.287s $ time for i in $(seq 1 1000); do dash -c ":" ; done real 0m1.067s user 0m0.408s sys 0m0.704s $ (export LC_ALL=C; time for i in $(seq 1 1000); do dash -c ":" ; done) real 0m1.043s user 0m0.409s sys 0m0.679s $ (export LC_ALL=C; time for i in $(seq 1 1000); do bash -c ":" ; done) real 0m1.721s user 0m0.783s sys 0m0.986s
- klodolph 3y agoWhy would I want to set my locale to “C”? My actual preferences are en_US, and it sounds to me like you’re asking me to misconfigure my shell.
- aidenn0 3y agoBash does more work for non C locales. Dash does not. You can configure bash without locale support when compiling it, or just set the locale to C to get a more apples-to-apples comparison.
- klodolph 3y agoIsn’t C the wrong locale, though? Why would I want to use something which is incorrect as the basis for comparison?
- aidenn0 3y agoIf you want the behavior that bash gives you with your locale, then dash scores "zero" on any benchmark, since dash does not implement that. If you don't want the behavior that bash gives you with your locale, then it's a correct comparison.