Zsh Profiling

Zsh includes a handy profiler which was useful when debugging slow startup times.

To use it add the following to the top of your ~/.zshrc:

zmodload zsh/zprof

Then once your shell is loaded you can run zprof to get a summary of the profiling data:

$ zprof
 num  calls                time                       self            name
 -----------------------------------------------------------------------------------
  1)    2        1443.77   721.88   62.10%    634.80   317.40   27.31%  nvm
  2)    1        1978.71  1978.71   85.12%    534.94   534.94   23.01%  nvm_auto
  3)    1         430.73   430.73   18.53%    384.18   384.18   16.53%  nvm_ensure_version_installed
  4)    1         377.78   377.78   16.25%    377.62   377.62   16.24%  nvm_die_on_prefix
  5)    2         153.45    76.72    6.60%     84.82    42.41    3.65%  antibody
  6)    1          81.57    81.57    3.51%     78.25    78.25    3.37%  chruby_use
  7)    1          46.55    46.55    2.00%     46.55    46.55    2.00%  nvm_is_version_installed