Skip to content

Bug: Slow startup/init in ZSH #977

@rnett

Description

@rnett

Bug report
SDKMAN's initialization is slow when using ZSH, adding almost a full second to shell startup.

Profiling (zprof):

 1)    3         489.19   163.06   29.26%    489.19   163.06   29.26%  __sdkman_export_candidate_home
 2)    3         479.16   159.72   28.66%    479.16   159.72   28.66%  __sdkman_prepend_candidate_to_path
 3)    1         210.40   210.40   12.58%    210.40   210.40   12.58%  handle_completion_insecurities
 4)    1         208.75   208.75   12.48%    208.75   208.75   12.48%  detect-clipboard
 5)    4         180.70    45.17   10.81%    177.84    44.46   10.64%  (anon)
 6)    1          67.81    67.81    4.06%     64.27    64.27    3.84%  __conda_activate
 7)    2          20.83    10.42    1.25%     11.96     5.98    0.72%  compinit
 8)    2           8.87     4.44    0.53%      8.87     4.44    0.53%  compaudit
 9)    2           6.14     3.07    0.37%      6.14     3.07    0.37%  _zsh_highlight_bind_widgets
10)    1           4.71     4.71    0.28%      4.63     4.63    0.28%  _zsh_highlight_load_highlighters
11)    1           3.51     3.51    0.21%      3.51     3.51    0.21%  __add_sys_prefix_to_path
12)    1           1.65     1.65    0.10%      1.65     1.65    0.10%  _p9k_init_ssh
13)   27           1.53     0.06    0.09%      1.53     0.06    0.09%  compdef
14)    9           0.97     0.11    0.06%      0.97     0.11    0.06%  is-at-least
15)    1           0.78     0.78    0.05%      0.78     0.78    0.05%  colors
16)    6           0.67     0.11    0.04%      0.67     0.11    0.04%  add-zsh-hook
17)   11           0.88     0.08    0.05%      0.35     0.03    0.02%  apt_pref_compdef
18)    1           0.90     0.90    0.05%      0.31     0.31    0.02%  _p9k_preinit

To reproduce
Add source "$HOME/.sdkman/bin/sdkman-init.sh" to .zshrc, profile using instructions from https://stevenvanbael.com/profiling-zsh-startup

Note that running the init script by itself is significantly faster, so there may be more to this.

System info

  • OS: Ubuntu WSL 2 5.10.16.3-microsoft-standard-WSL2
  • Shell and version: ZSH, 5.4.2
  • The output of sdk version: SDKMAN 5.12.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions