-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
YCM killing my vim with GoLang #1461
Comments
The go completer was merged 18 hours ago, so If you're saying that you have been experience these CPU overuse since a couple of days might not be YCM related. Are you working with large file by any chance? |
Yes, I'm working with a really big project but, I ran PlauginInstall to update all plugins and everything seems to be working fine again. |
@cfsalguero I was worried that you were experiencing CPU burst from this function. So if you still get those let us know. |
It seems to be working much better but I'm still having issues when writing strings (even having let g:ycm_complete_in_strings = 0) or when the list of candidates is too long. |
That is a very good question but I don't have a good answer. |
Try to use YCM as always and if you experience the same behaviour then we could think to add some logging to that function to see if that is the real cause. |
Hi again, Probably I would need to change the title and remove the word "killing', but it is working super slow. Thanks. |
@ekfriis You might have some ideas. |
Two ideas off the top of my head to narrow things down: Is it the ycmd process or the gocode process that is saturating the CPU? Are you completing things that have a lot of stuff that are possible completions? Example: a package with 10k costs defined in it. |
s/costs/consts/ @Valloric that would violate causality |
@ekfriis You can edit your comments on github. :) There's a little pencil icon in the top-right corner of a comment. |
Don't know how to tell. |
If vim is using 100% CPU, this is unlikely to be caused by YCM; most YCM logic happens in ycmd, which is a separate process. Do you perhaps have other vim plugins installed that might be interacting badly with YCM here? Try to reproduce the problem with only YCM loaded in your vimrc. |
One more thing.
After fixing that, it started to work much better. |
One idea: run in terminal gocode -in=yourfile.go autocomplete yourfile.go 200 (or some other number, If this bless up the CPU, it is gocodes fault. On Thu, Apr 16, 2015, 14:18 Carlos Salguero notifications@github.com
|
I dind't found a super slow line yet, but I was able to see (trying several times) a message that says: RuntimeError: Gocode returned empty json response |
@Valloric will YCM behave nicely if I throw exceptions in the case I don't understand the output from gocode? That is what I do now, for cases like @cfsalguero's above but I could just as easily return an empty set of completions instead of throwing. |
@ekfriis will |
Trying to do some completions on a garbage file, AFAICT it just returns an empty json. Is YCM expected to report compile errors? IMO I should change that RuntimeException to just return an empty set of completions. |
@ekfriis I'm not sure that return an empty set will be an optimal choice, I mean: I write YCM report compile errors if the completion engine is able to provide some. If you write C/C++ you get compiler errors, if you write python then you don't get those, since jedi don't generate errors, @Valloric can correct me if I'm wrong. |
@ekfriis If we know that we're not producing completions because of an error in the semantic engine, then we should report an error (by throwing an exception). See how the clang_completer handles it. YCM will then show that exception message in the Vim status area. On the other hand, if we know that there really are no completions to be offered, no error should be shown. The clang_completer currently errs on the side of always showing the error message if it never gets completions but that's because it's extremely rare to encounter a situation where libclang truly doesn't have anything to show. |
Hi, |
@cfsalguero have you checked vim-go? I use it with |
@cfsalguero In truth, I've specifically disabled active syntastic for Go since it did more harm than good for me: |
At the time I've concluded syntastic default setup wasn't good enough or taken with care. There's a long discussion related with those one mentioned previously: Hence, I've preferred to have more specific plugins than have active syntastic enabled. |
Hi @oblitum, For better or worse, if the gocode binary is on your path YCM will start using it to do Golang completion (and override the omnifunc which vim-go defines). @Valloric, do you think we should provide an override option? If we use the YCM blacklist option, will that kill the YCM omnifunc completion? In principle the new YCM implementation should be categorically better in terms of latency. It would be great if you could give it a try and let me know if you find otherwise! |
Even with syntastic disabled, YCM is imposible to use for me. |
@ekfriis Will do when I get some free-time. One thing is that I'm quite content with vim-go already, simply I have no latency, it was never a problem regardless of the packages I use, and my job machine is a very modest linux laptop. |
@vheon Yeah, thanks. I've got double confirmation of that, so it seems I should be afraid of =[ ] |
@Valloric could we do something like it is with clang completer? So checking if the user have set the appropriate flag in the build process? |
@cfsalguero is it possible for you to share the code you are working on (or a minimal test case)? |
I'll try to do it with an open source project I'm currently working on. |
@vheon We could do it that way, sure. |
Hi @cfsalguero, Another thought - can you check what gocode binary you are using? If you look at the stderr file reported by :YcmDebugInfo at the top you should see a line like "Enabling go completion using [path to binary" |
What I've found is that disabling vim-go t works a lot better. |
Remember, I'm online with my email. Feel free to contact me on G+ |
Hi @cfsalguero, I tried to recreate the slowness w/ vim-go with this minimal vimrc (following the install instructions at gmarik/Vundle.vim, Valloric/YouCompleteMe, and fatih/vim-go, respectively) and doing completions in the nsf/gocode package, but it seems okay to me: set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'gmarik/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'fatih/vim-go'
call vundle#end() " required
filetype plugin indent on " required
syntax on Can you try with this setup and/or post your vimrc? |
This is the link to my vimrc https://github.com/cfsalguero/vim_config |
There is any irc channel to talk? |
Hi @cfsalguero it is hard for me to communicate synchronously on IRC or equivalent - can you try the minimal vimrc above and see if you still have problems? |
with the minimal version it works Ok |
When I have a problem with my vimrc, I usually find the best way to debug On Fri, Apr 24, 2015 at 9:50 AM Carlos Salguero notifications@github.com
|
I did what you said, comment out most of my .vimrc and started over. |
Hi @cfsalguero, so what exactly were the lines that were bad in the end? If possible I would like it to work nicely with syntastic |
just removed syntastic and all its configuration. |
@cfsalguero so with only syntastic but no YCM you have no problem, with YCM and no syntastic you have no problem, but with syntastic and YCM you have a slow experience?? |
Really don't know what to say.
|
Just as a comment, depending on the file I'm still have slowness so I decided to use just a plain vim |
@cfsalguero if the project is Open Source could you share it? |
Sadly, no |
Hi again. :profile start profile.log and this is the result in the log file. I hope it helps. count total (s) self (s)
FUNCTION 70_OnCursorMovedNormalMode() count total (s) self (s) 57 0.040154 0.000238 call s:OnFileReadyToParse() FUNCTION 70_UpdateDiagnosticNotifications() count total (s) self (s) 59 0.000065 if !should_display_diagnostics
FUNCTION gitgutter#utility#not_git_dir() count total (s) self (s) FUNCTION 70_SetUpCompleteopt() count total (s) self (s)
FUNCTION 70_UpdateCursorMoved() count total (s) self (s)
FUNCTION gitgutter#utility#set_buffer() count total (s) self (s) FUNCTION 70_OnCursorHold() count total (s) self (s)
FUNCTION 70_OnInsertLeave() count total (s) self (s)
FUNCTION 58_Highlight_Matching_Pair() count total (s) self (s)
76 0.000398 if pumvisible() || (&t_Co < 8 && !has("gui_running"))
76 0.000240 let c_lnum = line('.') 76 0.000401 let c = getline(c_lnum)[c_col - 1]
FUNCTION gitgutter#utility#has_fresh_changes() count total (s) self (s) FUNCTION 70_AllowedToCompleteInCurrentFile() count total (s) self (s) 62 0.000140 if exists( 'b:ycm_largefile' ) 62 0.000339 let whitelist_allows = has_key( g:ycm_filetype_whitelist, '*' ) || has_key( g:ycm_filetype_whitelist, &filetype ) 62 0.000116 return whitelist_allows && blacklist_allows FUNCTION 70_OnInsertEnter() count total (s) self (s)
FUNCTION 70_SetUpYcmChangedTick() count total (s) self (s) FUNCTION gitgutter#utility#full_path_to_directory_of_file() count total (s) self (s) FUNCTION 70_OnFileReadyToParse() count total (s) self (s)
59 0.001046 0.000221 call s:UpdateDiagnosticNotifications() 59 0.000171 let buffer_changed = b:changedtick != b:ycm_changedtick.file_ready_to_parse FUNCTION gitgutter#utility#exists_file() count total (s) self (s) FUNCTION 70_BufferTextChangedSinceLastMoveInInsertMode() count total (s) self (s)
FUNCTION gitgutter#utility#is_active() count total (s) self (s) FUNCTION 70_DiagnosticUiSupportedForCurrentFiletype() count total (s) self (s) FUNCTION 70_OnCursorMovedInsertMode() count total (s) self (s)
FUNCTIONS SORTED ON TOTAL TIME FUNCTIONS SORTED ON SELF TIME |
@ekfriis so, I've tried it on OS X and even though it's overriding vim-go, I'm not seeing any issues. I think I'll stick with this setup, YCM overrides completion but I still take the rest from vim-go without issues I hope. Thanks! |
@ekfriis I've one concern though. Compared to other completion options even on YCM, the one built into YCM for golang is putting function prototype information at the type, instead of directly at the completion text. It looks like non conventional. |
Hi @oblitum, glad to hear it is working for you. I'm not totally sure I understand your suggestion, can you give an example of what you think the completion should look like? @cfsalguero sorry, just realized this fell off my stack. Looking at your profile, it seems the slowest functions are: 57 0.048729 0.007228 70_OnCursorMovedNormalMode() @Valloric, it looks like it is spending a lot of time in OnFileReadyToParse - is this normal? As far as I can tell, that is for the omnifunc(?), which should not be called at all in Go w/ the latest YCM. |
@ekfriis OnFileReadyToParse the client send the buffer to the server, so ycmd is able to pick up new candidates for the identifier-based engine, and the server would also call the same function on the current semantic completer if it defines said function but the gocode completer does not. |
Hi @ekfriis, for example, you may check the C and C++ completion that's displayed by the GIF in the official README, BUT, I think it's not a big issue, since it's not a standard followed by all languages. |
Since a couple of days, YCM started to use 99% CPU when using it with Go.
I've disabled Syntastic but there is no change.
There is any way to make it compile only when saving?
The text was updated successfully, but these errors were encountered: