ohmyzsh: Loading kubectl plugin is slow

The main reason is that it regenerates the completion script over and over, with kubectl completion zsh.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 8
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Experienced the same on Fedora, the cache doesn’t help because the slow part here is execution of function __kubectl_bash_source() from ${ZSH_CACHE_DIR}/kubectl_completion.

Upstream issue: https://github.com/kubernetes/kubernetes/issues/59078

I am having the same problem in Mac OSX Catalina 10.15.7 since yesterday when I updated via omz update. Startup time ranges from 5 to 10 seconds.

The debug startup freezes for some seconds in the following lines:

+/Users/xxxx/.oh-my-zsh/cache/kubectl_completion:12832> __kubectl_convert_bash_to_zsh
...
+/Users/xxxx/.oh-my-zsh/cache/minicube_completion:2673> __minikube_convert_bash_to_zsh

@lbolla I don’t think, it is completely fixed or something else is wrong with my setup? In my machine, it still takes a lot of time to load. Here is the profiling screenshot.

screen shot 2018-08-20 at 8 02 21 am

That is on every new tab in Iterm. But on existing tab, it’s not taking much. screen shot 2018-08-20 at 8 07 04 am

any news on improvements here?

num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)    1         190.03   190.03   65.52%    189.83   189.83   65.45%  __kubectl_bash_source

Oh and you need to use kubectl 1.22 or higher for the faster zsh completion logic.