abingham/emacs-ycmd

For grins: emacs-ycmd + company-ycmd slightly slower than vim's YouCompleteMe for C++

Opened this issue · 2 comments

I and several others at my workplace have been using emacs-ycmd for a while on a large C++ project and everyone seems to be quite happy (including me), so thank you!

For grins, I notice that in a head-to-head, emacs vs. vim setting, a vim installation of YouCompleteMe feels about 50 msec faster to suggest completions for a large class in a large project than emacs installation of emacs-ycmd + company-ycmd.

This is using identical configuration: same terminal, terminal font, ycmd config, and writing the same code. The extra lag only seems to be noticeable when suggesting a large number of semantic completions (e.g., a std::vector):

image

This is with setting company-idle-delay to a low value (1 ms -- which I normally leave at 100 ms. Again, this is for grins). It's also with setting company-ycmd-request-sync-timeout to 0, which I've found to work best in this particular file I'm using for the comparison.

Has anyone explored this and come up with an explanation for why it's slower?

I don't know of anyone who's looked into it, but it wouldn't shock me if we're slower than we could be. Some quality time with the emacs profiler might turn something up, but I think a critical part of the work would involve de-conflating emacs-ycmd and company (though I suspect company is pretty quick).

amno1 commented

Vim does not go through a layer of elisp interpreting, though 50ms sounds quite a bit. Font-locking in Emacs is really slow, works through regular expressions, I don't know how it works in Vim, but it might add up. Also, check how does it compare if you run Emacs in terminal vs in X window as well as if you run standalone process in terminal vs server and terminal client. I guess Emacs and Vim are a bit apples to oranges comparison so it isn't very strange there is difference in performance. However 50 ms is not something to really worry about. That time is not really noticeable for normal use. Your brain thinks at about 80ms so you are still thinking slower than that :-).