New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Startup and startup time problem.. #893
Comments
I was watching the startup time as well since I'm pretty obsessed about it. The fact that you see the hangs on the terminal background is because the heavy duty is done on VimEnter though the Here is the profiling of the function from cold cache. As you can see the lines that takes more time are: L17 L19 and L30 Now I don't know anything about how python import things and I'm not familiar with the codebase at the point where I could tell you if something is possible to reduce the startup time. So enough talking to me and let's wait for @Valloric :P |
From the look of @vheon's profile (thanks for that btw), most of the time is spent loading and executing Python code. There's no easy or simple fix for this, and I'm not even sure it's possible to lower this without sacrificing functionality. It would certainly be even longer if the code were VimScript. I don't see a clear way to progress on this. PRs welcome, as usual, but I doubt anyone could do much here. Personally, Vim with YCM starts up instantly for me, but both my machine at home and my workstation at work have SSD drives and fast CPUs. |
So, nothing can be done? |
I can't see anything that would both work and be worthwhile doing. I'm open to suggestions. |
If it's not a problem, please reopen the issue. That way it'll be not forgotten. Thank you. |
I close issues that don't have a clear path ahead to being resolved. Otherwise they just clog up the tracker and still never get addressed (open or closed). The issue can always be reopened. |
I am also having these same issue. Running
takes almost no time at all, but if I do just a normal
with YCM enabled, then it will take >2 minutes for the file to load. As soon as I disable YCM, the startup time drops to about 100ms. What's weird is that using ^L to refresh the page causes no changes, however if I change the size of the window (like @aksr), then I do get the same issue. To the untrainted eye, it seems as if vim (particularly YCM) is locking up the screen somewhere. My guess is that it times out fully after about 2 minutes (127 or so seconds) and then just fails. It only seems to happen when there's syntax highlighting and/or filetype plugin and indenting are on in my tests. The CPU isn't getting maxed, and the load is staying at a normal level. Do really hope that this issue can be revisited. EDIT: This happens in a python2 virtualenv, python3 virtualenv, and in no virtualenv at all. Don't know if any of that would help or hurt this. |
Can I make YCM not to enable itself automatically when vim starts up? |
I personally use vim-plug as my plugin manager and I have this in my vimrc:
Thats because sometimes I start vim just to read some code and not make changes and I don't want to pay the extra cost when not using it. Anyway the first time you enter insert mode you have to load YCM and there's going to be some hang. This is really a hack and I don't know for how long this will be in my vimrc (I guess as soon as I install the SSD on my machine this will go away) and it uses the vim function used on |
Thanks. vim-plug is somewhat a good alternative of Vundle indeed, buying SSD is out of the question. Adding an option to customize if YCM should auto start can be a robuster solution. I think if vim supports multiple threads, all problems like hang or frozen or something else can get solved. There seems to be such a patch for vim already, but why doesn't vim team merge it directly. Sorry for my complaint. |
Is there no possibility to call Like not having the ycm featuers until that routine is finished, but not blocking anything else!? |
@ikcalB No. You're asking for async function call that in vim is not possible. |
@vheon thanks for clarifying If one could configure the event, and leave that empty, the initialization could be triggered by the user itself |
@ikcalB I did that and if you're experiencing lag on vim startup is much more pleasant to get the lag on vim startup instead of getting lag when you want to write something. Anyway that is how I did that with vim-plug https://github.com/vheon/home/blob/c71c60fcb4d9bf7fb9fe937bc3842735559d36a2/.vim/vimrc#L51-L70 |
@vheon tnx for sharing! I tried using The only drawback is, that the changes are lost on upgrade. (as plugins are sourced after my |
What plugin manager are you using? Whatever you are using I highly recommend vim-plug (If you came from Vundle the switch is very easy) and then you can use the setup that I showed you and tweak it for any pattern that you like. Anyway even that is no officially supported by YouCompleteMe so if anything breaks your setup you can blame only yourself :P |
Using NeoBundle (because I used neocomplete) and quite like it! |
I don't understand the correlation between the two (except the same author) but if you're comfortable with neobundle there's no need to change and it actually have lots of support for on lazy loading the plugin. I you configure the bundle like this: NeoBundleLazy 'Valloric/YouCompleteMe', { 'augroup': 'youcompletemeStart' } Then it know what function to call for the startup and calls them when you will load the bundle though |
@vheon WOW! Didn't know about that one. Works great, now I can call & many Thanks again!! |
I use neovim and I have the same problem, YouCompleteMe increases the load time with about 1 second. However, neovim has async support. I use the vim-plug manager. Is there a way to load YCM in an async fashion after neovim started? Update: neovim with vim-plug has a solution for this problem, as explained here: https://github.com/junegunn/vim-plug/wiki/faq#loading-plugins-manually . It gives a concrete example with YCM. |
I'm using Arch Linux, gvim/vim from the official repository.
Vim with YCM takes too much to startup, even on the empty file.
It hangs with terminal background color and the name of the file at the bottom.
I disabled other plugins, also I tried using new vimrc with only:
syntax on
filetype plugin indent on
No success.
I installed vim-youcompleteme-git from the AUR.
Everything runs fine without YCM.
I noticed a very strange thing: if i resize the terminal (or snap terminal from a tile to a float mode), file immediatelly opens and everything looks fine.
Also if syntax is not enabled automatically, I'm able to open file normally and to use YCM after i enable syntax manually. Meaning--everything is fine even if syntax is enabled if I, as soon as I open the file, "resize" the terminal. Immediatelly after resizing, file is shown.
Same happens with gvim, but "resizing" doesn't help
Similar problem (but without a details):
https://github.com/Valloric/YouCompleteMe/issues/740e
'vim --version' output:
http://privatepaste.com/ed01529bbf
'vim --startuptime $file' output:
http://privatepaste.com/cec6a8a3c9
These two work fine, after I manually enable syntax (which agrees with previously mentioned):
vim -u NORC -N $file
vim -u NONE -N $file
If there's anything I can do to help, please do tell.
Thank you.
The text was updated successfully, but these errors were encountered: