-
Notifications
You must be signed in to change notification settings - Fork 90
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
Performance issues with large coq files and evil vim commands #427
Comments
Can you collect a CPU profile? See https://www.gnu.org/software/emacs/manual/html_node/elisp/Profiling.html |
Does the slowdown happen during the processing of the file or after it? |
I'm experiencing this same issue. (require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(add-to-list 'package-archives
(cons "melpa" (concat proto "://melpa.org/packages/")) t))
(package-initialize)
(custom-set-variables
'(package-selected-packages (quote (evil proof-general)))) I installed two packages from MELPA, PG and Evil and that's it, nothing more. After processing the whole linked file, I invoked Here is CPU Profiler Report
Memory Profiler Report
|
Sure. Here are my profile reports for deleting 24 lines from the test document by repeatedly pressing When the slowdown occured, I got:
whereas without the slowdown, I got:
The slowdown in cpu cycles by a factor of ~100 is consistent with the slowdown in real time. |
Both. The slowdown increases proportionally to how much progress |
The problem comes from
Alternatively, reviving the Emacs patch to make overlays faster might help with this issue. It's on branch |
I think the following should work as a workaround, but obviously it's not a fix.
|
The problem comes from `evil-narrow-to-field`, which calls
`field-beginning`; calling just that function takes multiple seconds
on my machine.
Sounds like a bug worth reporting to Emacs.
Does calling `overlay-recenter` just before the call help (if not, then
presumably "the Emacs patch to make overlays faster" won't help either).
Stefan
|
Out of curiosity -- if that function is unconditionally slow, why does the slowdown happen only if a large chunk of a big file is typechecked? |
Thanks! The workaround works, indeed. But it still seems odd to me, that checking the whole buffer and then retracting it (running |
I think it's not unconditionally slow; only if there's many overlays.
Yes, I'm not sure why PG leaves overlays after retracting. @Matafou ? Here's an example:
|
It doesn't help. |
AFAIK there is no reason why overlays remain after retracting. Except performance maybe. |
Thanks! |
AFAIK there is no reason why overlays remain after retracting. Except performance maybe.
But on the other hand dealing with hundreds of overlays (maybe a few
thousand) should not be such a problem. Should it?
Indeed, it shouldn't be a problem. It's probably an algorithmic problem
somewhere in the fields code.
Stefan
|
I found the reason why there are spans left in the buffer after retracting: 'pghelp spans are not removed. I think this is on purpose: these overlays are for the contextual tooltips popups and one may want to have them even if the region is retracted. Since I cannot reproduce the bug on my laptop, @m0rphism can you try to apply this modification to you pg and see if the slow down disappears please? file generic/proof-script.el line 405: replace the proof-script-delete-spans function by this one:
|
If the this solves the slowdown, 1 obvious questions:
Another question is:
Any opinion? |
Since I cannot reproduce the bug on my laptop, @m0rphism can you try to
apply this modification to you pg and see if the slow down
disappears please?
While we'll probably need a workaround in Proof-General, the problem
seems to be fundamentally in `field-beginning`.
Has it been reported to Emacs yet?
|
Yes, let's remove them
Not to me either. In fact, company-coq disables them. |
Not by me ^^ |
I'm experiencing the following odd behavior:
I open a fresh emacs instance with a large coq file (example file below) and every edit operation is fast as expected - independently of where the cursor is located in the buffer.
Then I check the complete buffer by using
proof-goto-point
at the buffer end, which causes some normal mode commands likeevil-delete-whole-line
(pressingdd
in normal mode) to take multiple seconds to finish, but regular editing commands in insert mode are still fast (in particular deleting a line break with backspace).I retract the buffer by using
proof-goto-point
at the buffer beginning, but the slowdown persists.I run
proof-shell-restart
and all commands are fast again.I'm using the Coq spacemacs layer (without
company-coq
), but I don't think the behavior is caused by the layer, so I'm posting the issue here. Unfortunately, I'm not familiar enough with plain emacs to quickly test a pure evil mode + proof general setup.This example file triggers the behavior on my machine and simply repeats the following code for 4000 lines:
The text was updated successfully, but these errors were encountered: