I am currently using ubuntu 20 and using zsh + oh my zsh shell . The issue is zsh shell is taking abnormally long time to start up. To puts things in perspective , its almost 9 times slower than raw bash when compared using time command
Time Check using Raw bash
for i in $(seq 1 10); do /usr/bin/time bash -i -c exit; done
exit
0.02user 0.07system 0:00.19elapsed 45%CPU (0avgtext+0avgdata 1816maxresident)k
136inputs+0outputs (3major+1737minor)pagefaults 0swaps
exit
0.05user 0.04system 0:00.17elapsed 52%CPU (0avgtext+0avgdata 1820maxresident)k
0inputs+0outputs (0major+1737minor)pagefaults 0swaps
exit
0.02user 0.06system 0:00.18elapsed 42%CPU (0avgtext+0avgdata 1824maxresident)k
0inputs+0outputs (0major+1745minor)pagefaults 0swaps
exit
0.08user 0.03system 0:00.21elapsed 51%CPU (0avgtext+0avgdata 1828maxresident)k
0inputs+0outputs (0major+1743minor)pagefaults 0swaps
exit
0.00user 0.06system 0:00.14elapsed 40%CPU (0avgtext+0avgdata 1816maxresident)k
0inputs+0outputs (0major+1736minor)pagefaults 0swaps
exit
0.02user 0.05system 0:00.14elapsed 50%CPU (0avgtext+0avgdata 1820maxresident)k
0inputs+0outputs (0major+1738minor)pagefaults 0swaps
exit
0.00user 0.06system 0:00.13elapsed 46%CPU (0avgtext+0avgdata 1820maxresident)k
0inputs+0outputs (0major+1741minor)pagefaults 0swaps
exit
0.01user 0.05system 0:00.14elapsed 40%CPU (0avgtext+0avgdata 1816maxresident)k
0inputs+0outputs (0major+1738minor)pagefaults 0swaps
exit
0.00user 0.07system 0:00.14elapsed 48%CPU (0avgtext+0avgdata 1816maxresident)k
0inputs+0outputs (0major+1738minor)pagefaults 0swaps
exit
0.01user 0.06system 0:00.13elapsed 50%CPU (0avgtext+0avgdata 1816maxresident)k
0inputs+0outputs (0major+1737minor)pagefaults 0swaps
Time Check using zsh + oh my zsh
for i in $(seq 1 10); do /usr/bin/time zsh -i -c exit; done
0.67user 0.82system 0:02.54elapsed 58%CPU (0avgtext+0avgdata 4676maxresident)k
0inputs+0outputs (0major+8337minor)pagefaults 0swaps
0.66user 1.01system 0:02.88elapsed 57%CPU (0avgtext+0avgdata 4676maxresident)k
0inputs+0outputs (0major+8329minor)pagefaults 0swaps
0.51user 1.11system 0:03.17elapsed 50%CPU (0avgtext+0avgdata 4676maxresident)k
0inputs+0outputs (0major+8345minor)pagefaults 0swaps
0.74user 0.76system 0:02.78elapsed 53%CPU (0avgtext+0avgdata 4676maxresident)k
0inputs+0outputs (0major+8339minor)pagefaults 0swaps
0.59user 0.99system 0:02.74elapsed 57%CPU (0avgtext+0avgdata 4676maxresident)k
0inputs+0outputs (0major+8326minor)pagefaults 0swaps
0.80user 0.86system 0:02.88elapsed 57%CPU (0avgtext+0avgdata 4676maxresident)k
0inputs+0outputs (0major+8339minor)pagefaults 0swaps
0.63user 1.02system 0:02.78elapsed 59%CPU (0avgtext+0avgdata 4676maxresident)k
0inputs+0outputs (0major+8330minor)pagefaults 0swaps
0.87user 0.89system 0:03.08elapsed 57%CPU (0avgtext+0avgdata 4676maxresident)k
0inputs+0outputs (0major+8325minor)pagefaults 0swaps
0.68user 0.98system 0:02.89elapsed 57%CPU (0avgtext+0avgdata 4676maxresident)k
0inputs+0outputs (0major+8323minor)pagefaults 0swaps
0.71user 0.88system 0:02.81elapsed 56%CPU (0avgtext+0avgdata 4676maxresident)k
0inputs+0outputs (0major+8338minor)pagefaults 0swaps
I would like to clear it again that delay in zsh only happens when opening terminal at start , not during general usage. I have disabled all plugins and using powerlevel10k theme , although i can definitely say it has nothing to do with theme. I noticed this slowdown immediately after i had changed to zsh shell which got even worsened after i installed oh my zsh I also told some of my friends to do this test and their zsh timings were very very slightly higher than raw bash , well thats acceptable but mine seems totally abnormal.
General recommendations are also welcome but more specifically i would like to ask if there's anyway i can actually check what exactly does the terminal does in background while its taking approx 3 seconds to start up in zsh as opposed to 0.2 seconds on bash
Here's my .zshrc file if that helps
Edit - I tried doing same test with Raw zsh ( without oh my zsh ) The results are interesting , now the zsh shell is approx 4 times slower to start , it averages around 1.2 seconds as opposed to 3 seconds seconds with zsh+oh my zsh