-
-
Notifications
You must be signed in to change notification settings - Fork 581
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
projectile-mode makes editior extremally laggy and slow #1183
Comments
Try cleaning up the cache ( |
I have got the exact same problem. I try to find a workaround. If you have one, plz post. |
Here is the profile log:
|
You should try this workaround: brocode/emacs_subconfigs@831d654 As I understand it a new feature is that projectile tries to determine the project type by going through heuristics. For golang projects the heuristic is "go through all files in the project and see if it ends with There was #1182 open but it was fixed in the sense that projectile does not try to determine the project type when there is no project (it would go through all files in your $HOME then). But if your project is huge you will feel the pain. (note: the format string in that workaround commit is broken, you want |
Hmm, I guess I underestimated this - I'll try to take a look at it soon, but in the meantime everyone can just set the modeline to
|
Looking at the profiling data it seems something is wrong with the project type caching, otherwise I can't imagine what would be causing this slowdown. (defun projectile-detect-project-type ()
"Detect the type of the current project."
(let ((project-type (cl-find-if
(lambda (project-type)
(let ((marker (plist-get (gethash project-type projectile-project-types) 'marker-files)))
(if (listp marker)
(and (projectile-verify-files marker) project-type)
(and (funcall marker) project-type))))
(projectile-hash-keys projectile-project-types))))
(when project-type
(puthash (projectile-project-root) project-type projectile-project-type-cache))
project-type))
(defun projectile-project-type ()
"Determine the project's type based on its structure."
(if projectile-project-type
projectile-project-type
(let ((project-root (ignore-errors (projectile-project-root))))
(if project-root
(or (gethash project-root projectile-project-type-cache)
(projectile-detect-project-type)
'generic)
'generic)))) That's all the relevant code and it's pretty simple. At least right away nothing seems wrong with respect to caching here. |
For what is worth in my tests I don't see any lag. |
Thx a lot. So, if I understand correctly: Every time the cursor moves, the mode line is updated, and so every time projectile tries to determine the project type, which is very slow (to determine go projects). If there is a problem with my projectile cache, how can I remove/invalidate it? Here is a second part of the profile, that could confirm the slowness in determining go projects:
|
Same issue here, and the workaround helps. |
@bbatsov I think it's just the golang detection that is super inefficient. (cl-some
(lambda (file)
(string= (file-name-extension file) "go"))
(projectile-current-project-files))) On linux (using In the elisp profiles I'm not sure why The caching seems to be working for me (if I let the initial project type detection complete, which takes upwards of 5 minutes (!) then it's using the cached type). Also the |
Same issue and I reached same workaround.
|
@mriehl Yeah, that's very inefficient indeed, but on the other hand once the type is detected it is cached. However, on a bigger project the initial delay might be quite significant. If someone has a better way to detect go projects - I'll all ears. :-) |
I've tested this again locally - for I see that project types are properly cached and retried. Some of you should instrument |
While edebugging, I noticed that my directory .emac.d gets detected as 'generic. This can perhaps be the cause why editing my init.el is so extremely slow..... Hope this helps a bit. |
Also had this issue and disabled the modeline component. Emacs was nearly unusable. Does this callback need to happen every time the cursor moves? I would imagine that if it fired on switching buffers that would be sufficient. |
@rreckel Ah, that's probably it! I'm assuming a lot of people had issues outside projects. @pcmantz Yeah, that's how it works by default - I wish there were ways to tune this behaviour. It caused so much pain, that I'm seriously considering making this static just on find-file, but that has downsides as well (e.g. when you're doing things like switch-project the modeline won't update). |
affected too :( , i'll try the workaround, regards |
I'm also affected on a small-ish php project (<5000 loc). This was causing 7-10s of lag between cursor moves, and persisted between Emacs restarts. The workaround works for me though! |
Workaround works for me, thanks |
I'm experiencing the same high latency, but only noticed it when editing an elisp file. My C++ projects weren't affected, or were affected much less (that I didn't notice). The workaround @bbatsov provided seems to have fixed the issue. Thanks |
I'm affected as well. Mostly the problem appears when editing elisp files. |
Let me make a wild arsed guess here.... Those of us who are experiencing this have something mounted that imposes a delay when queried. Usual culprits are...
My guess is @bbatsov is not experiencing this because none of the directories between his current work directory and / have one of these mounts. A simple fix would be stop looking for vc directories if you hit /home/* or / Alas, I suspect this won't be bullet proof, so I suspect it would be better to turn off this feature by default. |
That could be the case indeed. However, the lagging never stops and makes working with emacs pretty much impossible. As for making the feature optional, I totally agree. I don't even see the information displayed for projectile in the modeline until I expand the list (which I never do). I value performance and responsiveness much more. |
Same as @nickenchev, C++ projects are OK. Python, elisp, etc are not. |
I've met this issue while trying to edit elisp files for Prelude (~/.emacs.d/personal/). All of my python projects are fine. Workaround works for me too. |
see bbatsov/projectile#1183 if the system is mac, set clang as checker for flycheck
The workaround also works for me. Before it local (on a SSD) and remote Python projects were completely unusable. However I should add that the machine I tested it on is very old (2008-ish). |
Just experienced this after updating. Couldn't even scroll properly. In any buffer (yaml, list-packages, ...) where projectile was enabled. Removing the type from the mode-line worked. |
I got this issue with org-mode files. The workaround has fixed the issue for me. |
Is a fix being worked on for this? Perhaps the new feature should be customizable so it can be more easily disabled? |
It's rather a problem, though workaround has worked. I wish that got a permanent fix. Thanks! |
Just adding another voice in here--I stopped using emacs for a few days because it became basically unusable. bbatsov's mode line workaround has resolved the issue for me. |
重くなったので設定を追加 cf: bbatsov/projectile#1183
I'll drop my word here also: Modeline workaround works great though, thanks a lot @bbatsov |
Yeah, the problem is the caching of the generic project type. I'm sorry for
the pain this small change caused to so many of you. I'll try to find some
time to look if I can fix this or I'll simply revert it.
On Mon, Oct 23, 2017 at 06:16 Valentin Ignatyev ***@***.***> wrote:
I'll drop my word here also:
It works well on easily distinguishable project types like python. But it
lags heavily on my home folder which is under git too. I guess it's quite
typical case if you check the comments mentioning this issue :)
Modeline workaround works great though, thanks a lot @bbatsov
<https://github.com/bbatsov>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1183 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGVykm0xQcfipjdqKNk_Znb1zPdtR5Rks5svBMegaJpZM4Pzlkr>
.
--
Best Regards,
Bozhidar Batsov
http://www.batsov.com
|
Just to note I'm also affected (editing anything it seems with projectile-mode enabled). |
Here’s an analysis that you might find useful. (And thank you for providing a workaround in the meantime.) There are three elements that, combined, I think are enough to explain everybody’s observed behavior. I list them below. First, for this watching along, this is how project detection works:
And here are the three elements that affect each of the above, making it slow in different scenarios:
Some possible ameliorations to consider:
Long-term advice to make it faster.
I hope this helps. Thank you for your work on Projectile, I use it everyday and it improved my use of Emacs a lot. |
I use this hacky workaround to cache the lighter for each filename: (defvar projectile-lighter-cache (make-hash-table :test 'equal))
(setq projectile-mode-line
'(:eval
(or (gethash (buffer-file-name) projectile-lighter-cache)
(puthash (buffer-file-name)
(format " Projectile[%s(%s)]"
(projectile-project-name)
(projectile-project-type))
projectile-lighter-cache))))
|
Indeed
I wonder why (defun projectile-verify-file (file)
"Check whether FILE exists in the current project."
(file-exists-p (projectile-expand-root file))) which resulted in an remarkable speedup. |
Before this chance if the project type was 'generic there was project type caching. For the issue to be solved completely we'll need to introduce something similar to the projectile-cached-project-name, though.
I've fixed the fixing for 'generic project types, so this should work ok within projects, although to fix it better it needs to use buffer-local caching for the project type. (similar to what we have for |
It was implemented in terms of wildcard expansion just to handle cabal projects. Now the cabal project detection simply uses a different function.
By putting the slowest checks last we make sure that people won't have to experience them unless all other fast type checks have failed. See the discussion on the ticket for more details.
@dato Good points and very valid. I did a couple of tweaks to the project detection now. There are so many easy wins in Projectile here and there, unfortunately I rarely find time for it these days. |
Push some (subjectively) more common project types earlier in the resolution order.
重くなったので設定を追加 cf: bbatsov/projectile#1183
I'm using projectile for a while, and I'm extremaly happy with that.
But recently, after package update something went wrong. When projectile-mode is enabled, all my actions in editor (like typing, and navigating in file) started to be very slow, practically making normal work impossible.
When I disable projectile-mode, then all issues magically disappear and I can continue my work. I compared two projects (both .git based).
I believe, that this wasn't the case in a past, but when I recently upgraded to newest (20171009.84) version, it started to crawl.
The text was updated successfully, but these errors were encountered: