-
Notifications
You must be signed in to change notification settings - Fork 167
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
Omnisharp takes excessive time and memory usage when fired from Omnisharp-vim #558
Comments
Please share your .vimrc and give some description of your environment |
The OmnSharp stuff:
The full
|
I this problem appears to be exacerbated by quickload. Disabling quickload dropped my memory usage to ~800-1000MB and CPU usage isn't quite as high either. Both are still higher than VS Code even with quickload disabled. |
Are you comparing memory of the actual OmniSharp.exe process? In my experience the process started by Vim generally idles at a significantly lower memory usage than once started by VScode. You're using pathogen so I can't easily tell - do you have many other plugins? You're not using YouCompleteMe or coc.nvim by any chance? |
Yes, I'm comparing the usage of the mono process hosting OmniSharp.exe in both cases. Several other plugins are enabled:
Not using YouCompleteMe, but I am using Asyncomplete. Here's a couple of screenshots Since turning off quickload, I think things have improved, but they are still not right. The memory usage in those two screen shots actually are closer, but what is far off is the speed at which VSCode completes it's project parsing. It completes in a moment (settling memory/cpu usage being my factors for determining "done", as I don't have an objective signal to read in both cases beings OmniSharp runs in the background), while OmniSharp.Vim takes several to complete and settle down. The OmniSharp.vim spooled process also reaches 2GB of memory while starting up before dropping back down. The VSCode spooled process barely tops 1GB, if it even reaches that. Of final note, I'm having trouble with OmniSharp.vim declaring the symbols (class, method, properties) of the first file I open as duplicates. It doesn't matter which file I open, but it always appears to only affect the first file. |
It actually just sounds like your server isn't starting properly in Vim. There are some issues that I'm trying to get resolved regarding when to consider OmniSharp-roslyn to be "ready", see OmniSharp/omnisharp-roslyn#1521. It definitely sounds like What message is echoed when the server is "ready"? "Loaded server for ....sln"? Or "Server load notification for ... not received after 20 seconds"? Could you try, for the sake of experiment, nudging your If not, please post the output of |
That's exactly what I'm seeing when I mentioned the duplicate symbols. So it seems at least that part is related to that ticket. Whether that is related to the memory usage/startup cpu usage might remain to be seen. I'll try the |
OK I've done a bit of testing - that OrchardCore solution is huge - 172 projects. At first I thought I was seeing erroneous behaviour too, but actually it just takes a damn long time for OmniSharp-roslyn to load the solution. I ended up setting Running Vim and VSCode side-by-side in Windows, The |
Ohhhh. I've just looked more closely at your screenshots and I see what's happening. VSCode is only loading the single project - not the entire solution. Whereas OmniSharp-vim always looks for a .sln first and in this case it finds it ... so it loads everything. |
So there are a couple of ways you can tell OmniSharp-vim to just start OmniSharp-roslyn with just the current project.
Personally I prefer the 2nd option. Either way OmniSharp-vim starts up within a few seconds. |
Will circle back around to this this week. Sorry for the delay. |
Are you happy for me to close this issue, @Craige? The workarounds I described should solve the issue? The alternative I suppose is to add an option for OmniSharp-vim to search for .csproj files instead of / as well as .sln files, and start the server when it hits a .csproj. In this situation that would make O#vim work like VSCode. |
Found the same problem. using VIM+omnisharp-vimce, once operating on large .cs file, i can feel that vim will be waiting for the response of the server. For example when I editting a file with more than 10000 lines, hitting h,j,k,l, vim stuck there for 2-3 seconds, by the same time CPU usage is around 10% for omnisharp.exe, ~600 MB RAM. However if the current .cs file is not large (< 1000 lines), then everything is perfect. |
Anything I can do to improve the performance of omnisharp-vim editting large .cs file? |
Try turning off syntax highlighting. 10,000 lines in a single file of code? Really? |
Sounds like you need to refactor. At they very least, splitting your class into partial classes may help. More realistically, you need a larger refactoring to separate concerns. Your class is doing too much. |
Thanks guys! The project is legacy, pile of shit, have to work on that. The symptons of the issues is like.: After opened a >10000 lines .cs file, vim takes ~10 seconds to get everything loaded. Once I changed the .cs file a little bit, then saved the file. After 4-5 seconds, vim will stuck for around 3-4 seconds. That is very annoying. So I wanna be sure if this is the limmit of VIM + Omnisharp-vim solution, or I have to switch to VS (which i am realy not a fan of) |
I've never opened a file that big in omnisharp-vim. I'll be very curious to hear how it runs in vscode, for comparison |
The other guy here is editting his .cs file with more than 30000 lines, he says pretty OK, no stuck behavior as vim did. |
Well there's no concrete answer. Ideally it's nice to keep a code file to a size that can be viewed on a screen, but realistically C# has a fair bit of boilerplate so 500-1000 isn't unusual but it's not nice to work with.
This is too vague to be useful. The same computer running the same project would be a useful comparison. |
Tried out on my computer, same code. There is no noticable delay using Visual Studio. Everything is nearly perfect, when dealing with large .cs file using Visual studio. Tried on neovim-qt as well, same problem as the original vim. The drawback makes vim almost no competitive edge versus visual studio. |
Are you talking about Visual Studio or Visual Studio Code? Please try with Visual Studio Code, and ideally compare the logs. |
I am using Visual Studio, not Visual Studio Code. Sorry no visual studo code installed on my computer. |
Ok. VS has a totally different engine. Turning off syntax highlighting will make omnisharp-vim work faster on your huge file. Beyond that, you're teaching limitations of omnisharp. |
Thanks you guy. Maybe good time for me to learn Visual studio for all the .cs stuff. |
On the same project/solution, Omnisharp takes several minutes longer starting up when used under Omnisharp.vim as opposed to the same project opened in VSCode. Memory usage is also ~double the memory usage of the OmniSharp server under VSCode, and CPU usage spikes for a lengthy amount of time as well.
I'm not sure what the differences are between how VSCode uses the OmniSharp server and how OmniSharp.vim uses it, but there is clearly something significantly different causing significantly worse performance. This becomes more noticeable on large solutions/projects.
The text was updated successfully, but these errors were encountered: