Long lag on first invocation of Easymotion commands #136

Closed
jtcwang opened this Issue Apr 1, 2014 · 16 comments

Projects

None yet

3 participants

@jtcwang
jtcwang commented Apr 1, 2014

Hello,

I've noticed that since updating (I last updated 4 months ago), that the first invocation of any easymotion function is slow. When I start a fresh gVim instance, open a file and invoke any easymotion command, gVim will freeze for around 10 seconds.

Is this expected due to Vim's autoload mechanism and new features? Since I did not notice this in previous version of Easymotion.

Environment:
gVim 7.4
Windows 8
Easymotion v2.0

Cheers :)

@haya14busa
Member

Hi, @jtcwang. Thanks for your report.

Is this expected due to Vim's autoload mechanism and new features? Since I did not notice this in previous version of Easymotion.

Hmmm, maybe. Previous version didn't use autoload directory correctly, and loaded all files at startup, and I fixed it to use correctly and in addition, I added new features, and new autoload files...

gVim will freeze for around 10 seconds.

But, 10 seconds is too long, it's definitely more than expected... :(

Questions

Is it really occurred with any easymotion command? I especially improve find motions(e.g. <Plug>(easymotion-s), default <Leader><Leader>s), and it actually need to load more autoload files than other motions like <Plug>(easymotion-w)(default <Leader><Leader>w). Would you mind trying <Leader><Leader>w again?

the first invocation of any easymotion function is slow

If it's true, in other words, it's fast from the second times, it's considered to be highly probable that autoload files is the problems.

I can't reproduce it in my environment, but I'll look into it.

@jtcwang
jtcwang commented Apr 3, 2014

I tested on another computer, and the lag is significantly shorter (~1s), so it is most likely just a machine-specific lag.

I also did some test, easymotion-s has different lag period than easymotion-w.

Anyway, I think this is a non-issue and I'll live with it.

Thanks for your work. This is one of my favourite plugins.

@haya14busa
Member

Thanks for the test.

It's tradeoff, but if you want, please try this branch and add a following lines to your vimrc.

https://github.com/Lokaltog/vim-easymotion/tree/preload

" Preload autload files
call EasyMotion#preload()

Of cource, startup times of vim itself may become longer, but this method will avoid the first-time-lag problem.

Or you can use autocmd, such as FocusLost, to call this function.

@jtcwang
jtcwang commented May 16, 2014

Hi @haya14busa,

I have decided to revisit this issue. Has the preload branch been merged into the master branch? I can't seem to find the function in the latest update.

Cheers

@haya14busa
Member

No, I haven't merge preload feature into master because I don't know the preload function solves the issue. I can't reproduce long lag in the first place...
Would you mind trying this branch https://github.com/Lokaltog/vim-easymotion/tree/preload and give me the result.

@haya14busa haya14busa added the Improve label Jun 12, 2014
@haya14busa haya14busa changed the title from Long lag on first invocation of Easymotion commands (gVim) to Long lag on first invocation of Easymotion commands May 2, 2015
@timfeirg

I've had something similar, I'm on cfcafd7 and easymotion freezes when invoked, had to kill process to get out, while branch preload doesn't have this problem.

FYI for me this only happens when I'm working on some large code (800+ lines).

update

oh, I didn't put those lines in my .vimrc, so I wouldn't know if the preload feature call EasyMotion#preload() solves my problem

@haya14busa
Member

I just updated preload branch.
Could you please updating branch and trying it again?

@timfeirg

thanks for the quick response.

  • I tried 62b1008 on branch preload, and I tried with and without the following line in my vimrc:
" Preload autload files
call EasyMotion#preload()

vim freezes completely on invoking easymotion.

update

I rolled back a couple of commits to discover commit ef0cb2b (a week ago) won't freeze vim.

@haya14busa
Member

I rolled back a couple of commits to discover commit ef0cb2b (a week ago) won't freeze vim.

So, is the bad commit b686168 which is the commit after ef0cb2b?
If b686168 is not the bad commit, could you please trying git bisect to detect the bad commit?

I suspect that b11864a is the bad commit bad I cannot reproduce this.

@timfeirg

I'm quite confirmed that b686168 was the bad commit

@haya14busa
Member

FYI for me this only happens when I'm working on some large code (800+ lines).

  1. Please give me a example large code.
  2. Please tell me the Vim version
  3. Please tell me what mappings do you use? <Plug>(easymotion-s) or something.
  4. Does freeze means freeze Vim completely or just it take too long time?
  5. If you have some knowledge about Vim script, could you please debugging the code?
@haya14busa
Member

@timfeirg
There are actually bugs in easymotion and solved it right now. ref: #235
I guess the problem is the same, so could you please updating easymotion and cheking it?

@timfeirg
timfeirg commented Jul 1, 2015

I was having trouble determining what kind of file will cause the freeze, so it's the folds.
I'm on 2a2cf14 and this problem is gone.
thank you with all my heart, can I buy you guys coffee at bountysource or something?

@haya14busa
Member

thank you with all my heart, can I buy you guys coffee at bountysource or something?

Thank you very much but I don't use bountysource nor gratipay.
The problem was caused by just my mistake so it's happy enough for me to hear your kindness :)

@haya14busa
Member

I improved first loading time #282. Can you update the plugin and try it again?

@haya14busa
Member

must be fixed

@haya14busa haya14busa closed this Dec 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment