Skip to content

Could be worth noting in the docs that simply aliasing is faster #19

@alextes

Description

@alextes

With the plugin in my zshrc my startup timings look something like this:

num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)    1         336.87   336.87   41.83%    336.87   336.87   41.83%  chpwd_trash
 2)    1         778.28   778.28   96.65%    108.21   108.21   13.44%  zgen-init
 3)    1          83.84    83.84   10.41%     83.69    83.69   10.39%  _zsh_nvm_lazy_load
 4)    1          59.25    59.25    7.36%     59.25    59.25    7.36%  _zgen-check-for-updates
 5)    4         131.80    32.95   16.37%     47.98    12.00    5.96%  pmodload
 6)    2          47.20    23.60    5.86%     47.20    23.60    5.86%  compinit
 7)    3          26.29     8.76    3.26%     26.29     8.76    3.26%  mkdir
 8)    1          21.75    21.75    2.70%     21.52    21.52    2.67%  _zsh_highlight_load_highlighters
 9)    1          18.32    18.32    2.28%     18.32    18.32    2.28%  prompt_pure_state_setup
10)    2          18.14     9.07    2.25%     18.14     9.07    2.25%  promptinit
11)    1          11.00    11.00    1.37%     11.00    11.00    1.37%  _zsh_highlight_bind_widgets
12)    2          14.02     7.01    1.74%      7.11     3.55    0.88%  async
13)    1           6.91     6.91    0.86%      6.91     6.91    0.86%  async_init
14)    2          37.33    18.66    4.64%      3.68     1.84    0.46%  prompt_pure_setup
15)   14           3.24     0.23    0.40%      3.24     0.23    0.40%  (anon)
16)   12           2.64     0.22    0.33%      2.64     0.22    0.33%  add-zsh-hook
17)    3           1.12     0.37    0.14%      1.12     0.37    0.14%  is-at-least
18)    3           0.78     0.26    0.10%      0.68     0.23    0.08%  add-zle-hook-widget
19)   22           0.44     0.02    0.05%      0.44     0.02    0.05%  put_template
20)    1          38.37    38.37    4.77%      0.29     0.29    0.04%  set_prompt
21)    1          38.60    38.60    4.79%      0.23     0.23    0.03%  prompt
22)    1           0.20     0.20    0.02%      0.17     0.17    0.02%  zgen
23)    1           0.15     0.15    0.02%      0.15     0.15    0.02%  _zsh_nvm_has
24)    2           0.05     0.02    0.01%      0.05     0.02    0.01%  put_template_var
25)    1           0.03     0.03    0.00%      0.03     0.03    0.00%  is-callable
26)    1           0.03     0.03    0.00%      0.03     0.03    0.00%  zgen-saved
27)    1           0.02     0.02    0.00%      0.02     0.02    0.00%  put_template_custom

That first column and %-column is interesting to look at. Looking deeper zgen-init also spends time mostly on chpwd_trash.

With a simple alias to the python script, instead of the full plugin, my startup looks like this:

num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)    4         216.78    54.20   44.67%     86.15    21.54   17.75%  pmodload
 2)    1          83.53    83.53   17.21%     83.42    83.42   17.19%  _zsh_nvm_lazy_load
 3)    1          75.15    75.15   15.49%     75.15    75.15   15.49%  _zgen-check-for-updates
 4)    2          47.83    23.92    9.86%     47.83    23.92    9.86%  compinit
 5)    1         467.79   467.79   96.40%     43.60    43.60    8.99%  zgen-init
 6)    1          27.63    27.63    5.69%     27.63    27.63    5.69%  prompt_pure_state_setup
 7)    2          24.82    12.41    5.12%     24.82    12.41    5.12%  promptinit
 8)    2          36.88    18.44    7.60%     20.36    10.18    4.20%  async
 9)    1          16.53    16.53    3.41%     16.53    16.53    3.41%  async_init
10)    3          16.46     5.49    3.39%     16.46     5.49    3.39%  mkdir
11)    1          14.10    14.10    2.91%     13.87    13.87    2.86%  _zsh_highlight_load_highlighters
12)    1          12.97    12.97    2.67%     12.97    12.97    2.67%  _zsh_highlight_bind_widgets
13)   14           6.32     0.45    1.30%      6.32     0.45    1.30%  (anon)
14)   12           3.21     0.27    0.66%      3.21     0.27    0.66%  add-zsh-hook
15)    2          70.64    35.32   14.56%      2.88     1.44    0.59%  prompt_pure_setup
16)    3           1.79     0.60    0.37%      1.58     0.53    0.32%  add-zle-hook-widget
17)    3           0.78     0.26    0.16%      0.78     0.26    0.16%  is-at-least
18)   22           0.75     0.03    0.16%      0.75     0.03    0.16%  put_template
19)    1          71.87    71.87   14.81%      0.40     0.40    0.08%  set_prompt
20)    1          72.06    72.06   14.85%      0.19     0.19    0.04%  prompt
21)    1           0.19     0.19    0.04%      0.16     0.16    0.03%  zgen
22)    1           0.11     0.11    0.02%      0.11     0.11    0.02%  _zsh_nvm_has
23)    2           0.04     0.02    0.01%      0.04     0.02    0.01%  put_template_var
24)    1           0.03     0.03    0.01%      0.03     0.03    0.01%  zgen-saved
25)    1           0.02     0.02    0.00%      0.02     0.02    0.00%  is-callable
26)    1           0.01     0.01    0.00%      0.01     0.01    0.00%  put_template_custom

Much better! In milliseconds, for me, it made ~800ms -> ~500ms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions