Open sahinakkaya opened 3 years ago
Hi @Asocia
Firstly, thanks for the detail experience on this plugin :+1:. In fact, this plugin is initialized during the first precmd, it's different from most of other plugins that are initialized during souring the plugin. So the zsh-prompt-bencmark could not detect the prompt time of those plugins. Actually, the initialization time is short now. It will spend no more time on the following precmd, you can refer to the key source code.
Thanks and regards
Yes, as you said it is initialized only once. I disabled precmd hook for this plugin and initialized it myself but result didn't change. I'm curious what makes this plugin slow and if it is possible to make it faster. I really like this plugin and it would be great if this issue can be solved.
Some other examinations:
set -x
and then set +x
I can see a detailed trace. There is a lot of output which contains zsh-vi-mode
but I can't interpret it since my knowledge in this area is limited. I just wanted to share so maybe it helps. Thanks!
Hi @Asocia
There are lots of stuffs need to be done and they are necessary for this plugin running normally. I can add an option to let you set the time of initializating this plugin. And welcome to star this plugin for further updates in the future.
Thanks and regards
Hi @Asocia
Now this plugin has provided an option called ZVM_INIT_MODE
to configure the initialization mode (#113), you can use this snippet ZVM_INIT_MODE=sourcing
for doing the initialization inistantly when this plugin is sourcing.
Thanks and regards
Hi @jeffreytse,
I pulled the recent changes and added ZVM_INIT_MODE=sourcing
to my .zshrc
. I didn't observe any effect on prompt latency. Thanks.
Hi @Asocia
You're welcome and thanks for your checking out. If you get any other issues in the future, welcome to reach me.
Thanks and regards
Uhm, I think you got me wrong. By saying "I didn't observe any effect" I meant that the prompt is still slow as before. It was coming in 34ms and after applying the last change it's still 34ms.
Hi @Asocia , sorry for the misunderstanding, did you put the mode option before sourcing this plugin?
Yes, it's coming before plugins=(... zsh-vi-mode)
line. Actually I tried both case but no luck.
In fact, the zvm_init function will do a lot of neccessary works for the initialization. You can have a look and I will try to do some stuff to further reduce the initialization time in the future, thanks for your attention.
General infomation
Terminal: Konsole OS: Ubuntu 20.04 ZSH framework: oh-my-zsh ZSH version 5.8 ZVM version 0.8.3
Basic examination
Problem description
Enabling this plugin makes prompt 2.5 times slow. Am I doing something wrong?
Without any plugins
Nearly 15 plugins
15 other plugins and zsh-vi-mode
Here is all my settings related with this plugin:
Reproduction steps
zsh-prompt-bencmark
zsh-vi-mode
enabledzsh-vi-mode
not enabledExpected behavior
I expect this plugin to be not take too much time like the other ones.