-
Notifications
You must be signed in to change notification settings - Fork 48
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
Emacs racer is slow when autocompleting certain types, e.g. strings, with company-mode #91
Comments
It appears that a solution would be to write an asynchronous company-backend rather than a completion at point function. One even seems to already exist: https://github.com/emacs-pe/company-racer. I don't really know the full pros and cons of one solution over the other, but could both projects potentially be merged? |
Are you on Windows, by any chance? racer.el spawns processes, which is slow on Emacs on Windows. Agreed that we would really benefit from using a persistent racer backend and making async calls. This would particularly help with eldoc (see #86). company-racer uses an async call, but does not use a persistent racer process. It should be the same speed as racer for completion. racer.el provides a superset of company-racer functionality: we add eldoc, company is optional, we can find definitions and describe functions and types at point. |
No, I'm on Linux. In general the whole thing was fast, but some completions took a bit longer than others and that became noticeable in some cases. Anyway, I was playing around with it over the weekend and I have found the following:
That solved most of the lag when typing. However, there were a few edge cases where I still had some stuttering due to slow returns form racer. Most notably if I typed
If you like it, I could submit a pull request, but do note that: Let me know what you think, the requirement for a new dependency and the fact that at the moment I'm using one of my own additions to deferred stopped me from submitting a pull request, but if you like it, i can make an effort to make it all work. |
I've also experienced slow downs when using this with company, For example the following part of the guessing game tutorial resulted in lags up to 5 seconds making it almost unusable. let guess: u32 = guess.trim().parse()
.expect("Please type a number!"); I've experienced this on several different machines and operating systems. |
Yes, this is a problem I've been experience while using the clap library. I was hoping to see someone had a solution to this problem, seems like emacs-racer is blocking emacs. |
I'm also facing the same problem. I start with a simple binary project using My example code is: fn main() {
println!("Hello, world!");
}
struct That Edit: To add additional details, I'm running Debian 9, Emacs 25.1. |
I had a little time today to have a look at this, and I failed to reproduce :( @tushartyagi provided a great set of reproduction steps, but I'm not seeing performance issues on that case. Similarly for the code snippet by @rosstimson or the guessing game code by @Wojtek242. Would you mind confirming the value of Also, please try the following:
|
There is noticeable lag when trying to autocomplete string types on thy fly with
company-mode
. Taking the example from the guessing game in the rust bookWhen typing out the
match guess.cmp ...
line, Emacs noticeably stalls as soon as it tries to do completion at point, i.e. when I pause atmatch guess.
and then subsequently after every letter I type.At first I thought that something isn't playing well with
company-mode
, which did turn out to be the case, but that also turned out not to be the bottleneck. Having played around with it a bit further, I think the slow down is due to Emacs making a synchronous call toracer
with every keystroke and in this case theracer
command doesn't return fast enough to allow for smooth typing.i) Is there some known configuration I can use to avoid this problem?
My current configuration for
company
, andracer
is as follows:ii) If not, is this a known limitation? If so, are there any ideas how it can be fixed? Recently, I finally learned Elisp properly and have been hacking away at my config so I'm happy to help out myself, I just want to make sure I'm not going to be foolishly trying something that simply won't work. I don't think Emacs-racer currently does any caching and the calls are synchronous so those are two areas of improvement I can think of the top of my head with the latter perhaps being more attractive seeing as it could follow the example set by emacs-clang-complete-async.
The text was updated successfully, but these errors were encountered: