-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Ivy projectile find file / completion INCREDIBLY slow, CPU to 100%, and machine occasionally locks? #774
Comments
If it's working fine for helm, I suspect this may be Doom's fault. Try this and see if it helps anything: (after! counsel-projectile
(ivy-set-display-transformer
'counsel-projectile-find-file
'counsel-projectile-find-file-transformer)) |
Actually, the more I think about it, the less likely Doom is to blame. The above snippet undoes the only modification Doom imposes on ivy+projectile that could interfere with the file-list building process, and counsel's default consumes the same number of cycles. Also, 300-400 files is in fact, quite small. Doom has ~390 *.el files in So let's try this:
That will help us figure out where Emacs is struggling! |
I have experienced something similar. We have a lot of files in our project
and anything more than about 6 characters with the default fuzzy search
grinds to a halt.
…On Wed, 1 Aug 2018, 3:28 pm Henrik Lissner, ***@***.***> wrote:
Actually, the more I think about it, the less likely Doom is to blame. The
above snippet undoes the *only* modification Doom imposes on
ivy+projectile that could interfere with the file-list building process,
and counsel's default consumes the same number of cycles.
Also, 300-400 files is in fact, quite small. Doom has ~390 files in
modules/ alone, and it indexes almost instantly, regardless of the
backend projectile uses (git-grep or find).
So let's try this:
1. Switch to the problem project manually (i.e. switch to a file
inside it with M-x find-file)
2. Turn on the profiler with M-x doom/toggle-profiler
3. Invoke counsel-projectile-find-file with SPC SPC (if you've rebound
it, it's also bound to SPC f /)
4. Once it's done, or has taken too long, mash C-g until it aborts
5. Run M-x doom/toggle-profiler to get Doom to produce a report on
what it's been doing this entire time.
That will help us figure out where Emacs is struggling!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#774 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABRjpogQ8anoNyRgmFuephVn2SwBqpUks5uMbslgaJpZM4Vqh3p>
.
|
@ocharles Are you a windows user? Projectile falls back to an elisp implementation there, which is significantly slower. Although that does bring up a new possibility: do the two of you have |
I am using the default Of course since this issue arose I'm currently using Will try your profiler recommendations later this evening when I have a chance! |
Ah I see, yes, Could you try disabling it (then run Fuzzy search is powered by flx, which may be the cause. I'm planning to switch to presclient, which claims to be faster, but I'd like to be sure before I do. |
@hlissner Hmm? I'm using
|
No, Linux and I am using +fuzzy (and +childframe)
…On Wed, 1 Aug 2018, 4:02 pm Henrik Lissner, ***@***.***> wrote:
@ocharles <https://github.com/ocharles> Are you a windows user?
Projectile falls back to an elisp implementation there, which is
significantly slower.
Although that does bring up a new possibility: do the two of you have
+fuzzy enabled for the :completion ivy module?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#774 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABRjkrD8n-wiLbKJANhWZLQo4srhMWQks5uMcLzgaJpZM4Vqh3p>
.
|
@skalfyfan It's possible. It may not be |
@hlissner You got it! 💯 I just tested Ivy without
Then it craps out again as I described. I ran |
flx is much too slow with large lists of candidates (i.e. counsel-projectile-find-file).
Better fuzzy support versus flx; hopefully faster. Also brings frecency sorting to ivy commands.
Alright, I've replaced flx with prescient, which I hope will be faster for Give it a try and let me know if it has improved the performance of counsel-projectile-find-file in large projects. |
I've been using |
@hlissner just pulled the latest from Sorry to report that performance is just as bad w/ I'm going to try your profiler suggestion earlier and report back if I discover anything! |
@hlissner tried the profiler method you described here (using CPU jumped to 100% again so I had to terminate it with This is what I got in the report: Does that help? |
@hliebert @skalfyfan After some testing I've discovered there are inefficiencies in the I've come up with a decent solution which could use some more testing. Could you try adding this to your (after! ivy
(global-set-key [remap projectile-find-file] nil)
(setf (alist-get 'projectile-find-file ivy-sort-functions-alist) nil)
(setf (alist-get 'projectile-find-file ivy-re-builders-alist) 'ivy--regex-fuzzy)
(after! ivy-prescient
(add-to-list 'ivy-prescient-excluded-commands 'projectile-find-file nil #'eq))) This will disable ivy-prescient and counsel-projectile features exclusively for projectile-find-file, which I've found to be significantly faster. I'm testing it on the linux kernel (with over 60k files) on an decent i5, ssd, 8gb ram linux pc and the latency, while noticeable, is acceptable, so I'm hoping this will resolve the issue for much smaller projects. If you are in a project of 60k+ files or this fix doesn't help/is insufficient, I recommend either:
Let me know! |
counsel-projectile-find-file fontifies visited files and sorts the resulting file list from projectile-find-file, adding considerable overhead. Then, ivy-prescient performs a frecency sort and filter, adding more overhead. Altogether, this makes projectile-find-file unusable for larger projects when fuzzy search is on (and in some extreme cases, when it's off). This change disables both features specifically for projectile-find-file. Fixes #774, hopefully
I've pushed these settings upstream and then some. Let me know if that fixes your speed issues. |
@hlissner thanks for trying but sorry to say the refactoring did not help. 😢 My I guess I will have to stick with |
@skalfyfan This is very strange. I'm using this implementation on a 60k file project and it's only mildly sluggish (even on my core 2 duo toaster running El Capitan). A ~400 file project should be nothing. Even if you mistyped and meant 4k, it should still be snappy. Would you mind trying these few tests for me?
|
@skalfyfan Sorry for the late reply. I'm still uncertain about your specific case. It is true that there are unavoidable limitations to ivy that would cause this, but again, we're talking about large projects of 30k+ files. A 500-file project should not be experiencing these slowdowns. Your shell environment is suspect. Could there be any bottlenecks in your shell config? Perhaps initializing of plugins like oh-my-zsh, zprezto, pyenv, rvm, nvm, etc. I ask because, every time counsel (or helm, for that matter) calls ag/rg/pt (and it does so on every keystroke), it instantiates your shell environment, along with all its setup. |
@skalfyfan I've made some headway in optimizing ivy; specifically, I delay the garbage collector while the minibuffer is active. I hope this address your issue. If you have the time to update and hop over to ivy to try it, please let me know how it fares. |
@hlissner will give it a go sometime over this weekend and let you know! Thanks! 👍 |
Observed behavior
In large project folders (400+ files?) Projectile find file w/ Ivy is INCREDIBLY slow, with CPU processing jumping to almost 100% and occasionally even locking my machine. Is this Ivy completion issue w/ projectile?
Below is a screenshot showing the behaviour. In the below screenshot I have already completely typed out
src/services/submit-order-service/index.js
. We can see that Ivy Projectile find file is stuck atsrc/services
and that my CPU processing has jumped to 99.8% percent and clocking. My system in the below screenshot almost fully locked!Ivy has become completely unusable for me. I've switched to using HELM and have no issues with helm-projectile and finding files / completion. Everything is smooth and fast with HELM. However, I'd still prefer to use Ivy 😢
Is it maybe related to this merge commit? #740
Expected behavior
Ivy projectile find file / completion (SPC p p + typing file we're searching for) to be smooth and fast. Ivy completion to be just as fast as finding regular files (SPC f .) and HELM projectile find file.
Steps to reproduce
System information
Am using the
develop
branch of DOOM and working. Currently have HELM installed and have disabled Ivy.Please let me know if you'd like me to re-enable Ivy and do a complete debug dump!
Click to expand
The text was updated successfully, but these errors were encountered: