Skip to content

Latest commit

 

History

History
64 lines (42 loc) · 1.48 KB

article.md

File metadata and controls

64 lines (42 loc) · 1.48 KB

Speeding up zsh init times

Check zsh init time N times

for i in $(seq 1 10); do /usr/bin/time zsh -i -c exit; done

zsh initialization profiling

Add this to the start of your ~/.zshrc:

zmodload zsh/zprof

And this to the end:

zprof

Or if you want to play around with the output dump it in a file:

zprof > ~/dev/dotfiles/profiling.txt

Commands ZSH spent most of the time are at the top of the output.

compaudit & compinit are the slowest ones in my case.

Compinit is a function that initializes shell completion. After some googling I found out that the problem might be "too big" .zcompdump file, in my case it was about 1mb, so I deleted it (this file is autogenerated), and ZHS magically started to be faster.

This is something I will do as well.

After that I have added deleting this file to my user startup script.

Reference: How to debug zsh startup time

More improvements on compinit

autoloa -Uz compinit
if [ $(date +'%j') != $(stat -f '%Sm' -t '%j' ~/.zcompdump) ]; then
  compinit
else
  compinit -C
fi
source ~/.antibody_plugins.sh

Reference:


tmuxline