For me the biggest gain of Zsh is not the speed (I can't convince a fellow developer to save a few milliseconds every day :-P ) but the fact that it comes it themes and customizations. The Spaceship theme for example has been a real favourite, because it's easier on the eyes for long term use AND it actually saves me time due to the colour combinations giving me perspective faster.
I love zsh themes. There are plenty to choose from and each has amazing colour contrast. I am using Avit will try Spaceship theme. It is a difference of few milliseconds but it is taking just twice the time and this can be useful when performing heavy operations !
L.A. based web developer slowly parsing through Stack Overflow. If you like hot web dev tips or stories about being a freelancer, check out my newsletter: https://codenutt.substack.com/p/coming-soon
👋 Hey there, I am Waylon Walker
I am a Husband, Father of two beautiful children, Senior Python Developer currently working in the Data Engineering platform space. I am a continuous learner, and sha
I'm not sure I'd conclusively say zsh is faster. Yes, it takes less user time to execute your scripts. But the CPU load (sys) time is an order of magnitude less. It's probably preempting the CPU more, resulting in a longer user time, but lower system load. In anycase, yes, if the speed of the shell script in total time matters, zsh is good. But say you're on a VM or embedded system with 128MB of ram and a weak CPU... I'd rather run a long running watch on bash knowing it wouldn't furthur slow the process.
However, the customization/color options for zsh combined with the feature set are definately superior. This article has definately convinced my to atleast give zsh a shot.
The only downside for me is that I have hundreds of bash scripts around my codebase that were written to take advantage of bashisms and they would encounter errors. (Unless ofcourse I went in and explicitly added #! /bin/bash to each of these)
👋 Hey there, I am Waylon Walker
I am a Husband, Father of two beautiful children, Senior Python Developer currently working in the Data Engineering platform space. I am a continuous learner, and sha
I use zsh as my default shell everywhere. I love the ease of setting up an immensely better developer experience while using it. I still write all of my scripts to run in sh if possible otherwise bash.
I switched to zsh after this! ZSH with starship theme, syntax-highlighting and auto-suggestions features is simply the best! The emojis in the prompt is awesome and more human haha! Here's a prompt with emojis!!!
I could sense the possible reason behind this might be the sourcing of a few other files in the .zshrc. Sometimes it is also because of the plugins which are unable to find the command. I suggest you should find the reason why it is taking a long time.
You can try the following steps, they might help you in detecting the root cause.
To check the xtrace and verbose output you can try the command zsh -xv
Second you can try an order-blind profiler which will enable built-in profiling. For this you need to add zmodload zsh/zprof and zprof at the top and bottom of your .zshrc file. This will tell you where zsh is taking more time.
There can be few dependencies which slow down the shell's performance. For that, there is a great sandbox which will helps you to speed up the shell's performance in case this the culprit behind slowing down your shell.
For me the biggest gain of Zsh is not the speed (I can't convince a fellow developer to save a few milliseconds every day :-P ) but the fact that it comes it themes and customizations. The Spaceship theme for example has been a real favourite, because it's easier on the eyes for long term use AND it actually saves me time due to the colour combinations giving me perspective faster.
I love zsh themes. There are plenty to choose from and each has amazing colour contrast. I am using Avit will try Spaceship theme. It is a difference of few milliseconds but it is taking just twice the time and this can be useful when performing heavy operations !
Spaceship is the beeeeeest
I've been using the starship prompt lately. Takes care of everything I need out of the box.
With starship, we don't have to worry much about the shell as it works on top of it and provides easy customizations. :)
I'm not sure I'd conclusively say zsh is faster. Yes, it takes less user time to execute your scripts. But the CPU load (sys) time is an order of magnitude less. It's probably preempting the CPU more, resulting in a longer user time, but lower system load. In anycase, yes, if the speed of the shell script in total time matters, zsh is good. But say you're on a VM or embedded system with 128MB of ram and a weak CPU... I'd rather run a long running
watchon bash knowing it wouldn't furthur slow the process.However, the customization/color options for zsh combined with the feature set are definately superior. This article has definately convinced my to atleast give zsh a shot.
The only downside for me is that I have hundreds of bash scripts around my codebase that were written to take advantage of bashisms and they would encounter errors. (Unless ofcourse I went in and explicitly added
#! /bin/bashto each of these)I keep getting the opposite of your benchmark results.
I'm on:
I use zsh as my default shell everywhere. I love the ease of setting up an immensely better developer experience while using it. I still write all of my scripts to run in sh if possible otherwise bash.
I switched to zsh after this! ZSH with starship theme, syntax-highlighting and auto-suggestions features is simply the best! The emojis in the prompt is awesome and more human haha! Here's a prompt with emojis!!!
Totally agreed 🙌🏻
I am also using zsh with starship and it works great for me too. 😇
zsh faster than bash?
I could sense the possible reason behind this might be the sourcing of a few other files in the
.zshrc. Sometimes it is also because of the plugins which are unable to find the command. I suggest you should find the reason why it is taking a long time.You can try the following steps, they might help you in detecting the root cause.
xtraceandverboseoutput you can try the commandzsh -xvzmodload zsh/zprofandzprofat the top and bottom of your.zshrcfile. This will tell you wherezshis taking more time.Hi Jasmin, thanks for your reply, bash is faster than zsh in linux.
you can see the video below:
zsh vs bash performance in ubuntu 20.04 server
Thanks for sharing the video!👍
A pleasure, have a nice day Jasmin