-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Slow performance of Emacs, in general, and with LaTeX in particular #16517
Comments
I have noticed this too and am currently using the following workaround: (defun fn/not-in-pdf-view-mode (orig-fun &rest args)
(unless (eq major-mode 'pdf-view-mode)
(apply orig-fun args)))
;; evil-refresh-cursor is called as part of the window-configuration-change-hook
;; and seems to induce performance problems
;; TODO fix this properly
(advice-add 'evil-refresh-cursor :around 'fn/not-in-pdf-view-mode) Does this help? Of course it would be nice to have a proper fix, perhaps upstream in evil. |
Thanks; I am trying it. However, I feel there is a delay in moving the cursor upon writing. Probably, it is better, but still not smooth; even when switching between buffers |
Thanks, a profiler report could be helpful to diagnose the issue then; the profiler commands are bound under the SPC h P prefix. |
I think the latex layer is due for a review anyway. A profiler report would be cool though. |
I have added your workaround to the core, even if this is not the primary issue it is an issue which we should avoid. |
This is a profiler, but I think the problem does not appear here
|
I would try something like
Using |
The following is the profiler output, after just opening PDFs, several times, playing with window and so on. No LaTeX. The performance was really bad. even resizing windows, or maximizing window is slow. |
Sorry; the files access was restricted. Now, it is open |
Part of the latex rework task |
This is probably a problem upstream in pdf-tools and probably unrelated to the latex layer. I just found that setting If disabling |
Sounds good, lets change the default |
Apparently, setting the option to |
Is this fix included as a default in Spacemacs now? I still observe the same problem! |
Oh that's not good. What is the value of In particular, I could reproduce the problem with the following steps:
It is included, but I think this initial workaround only addressed a part of the symptoms, not the cause of the problem. I think this must be a bug upstream related to |
Thanks for your reply.
I set pdf-view-use-scaling to nil and the problem still exist. I just want to clarify something. I do not think it is related to pdf. The problem appears even I open emacs, and start editing in the LaTeX buffer, without opening any pdf. The writing is very slow.
… On Feb 4, 2025, at 11:01 AM, fnussbaum ***@***.***> wrote:
I still observe the same problem!
Oh that's not good. What is the value of pdf-view-use-scaling on your system? @DrWaleedAYousef <https://github.com/DrWaleedAYousef> I could only reproduce the slowdown when this variable was t. Hence we set the default value to nil in #16584 <#16584>.
In particular, I could reproduce the problem with the following steps:
Set pdf-view-use-scaling to t, set pdf-view-use-imagemagick to nil. On my system, the problem does not appear with either of the variables toggled.
Open a pdf file and zoom in (pdf-view-enlarge) at least once. The problem does not appear yet.
Zoom out (pdf-view-shrink) at least once. Now everything is slow as described above (though this is not observable in profiler reports).
Is this fix included as a default in Spacemacs now?
It is included, but I think this initial workaround only addressed a part of the symptoms, not the cause of the problem. I think this must be a bug upstream related to pdf-view-use-scaling. But please let me know if you still observe the problem while pdf-view-use-scaling is set to nil.
—
Reply to this email directly, view it on GitHub <#16517 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC5FXTJDEIPKVSNETMERLVD2OEFB7AVCNFSM6AAAAABL6ANE5OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMZUHAYTQNBUGU>.
You are receiving this because you were mentioned.
|
Unfortunately I cannot reproduce this. Some ideas to narrow it down:
|
Thanks for support. I tried everything; it is slow. A new empty file is better, but not normal as well. Please, see this value if it is fine:
|
Hmmm you have a lot of global modes active. My post command hook looks like this: Value in #<buffer>
(flycheck-perform-deferred-syntax-check
flycheck-error-list-update-source
flycheck-error-list-highlight-errors
flycheck-display-error-at-point-soon
flycheck-hide-error-buffer
lsp--post-command
eldoc-schedule-timer
lsp-ui-doc--make-request
lsp-ui-sideline
jit-lock--antiblink-post-command
evil--jump-handle-buffer-crossing
evil-normal-post-command
TeX-fold-post-command
sp--post-command-hook-handler
yas--post-command-handler
company-post-command
preview-move-point
t) My mode description for latex mode is Minor modes enabled in this buffer: Latex-Math Tex-Pdf Tex-Fold Anzu Auto-Fill
Auto-Save Company Company-Quickhelp-Local Diff-Hl Display-Line-Numbers Eldoc
Emoji-Cheat-Sheet-Plus-Display Evil-Local Evil-Matchit Evil-Surround Evil-Tex
Flycheck Font-Lock Goto-Address Hl-Todo Lsp-Completion Lsp-Diagnostics
Lsp-Headerline-Breadcrumb Lsp-Managed Lsp Lsp-Modeline-Code-Actions
Lsp-Modeline-Diagnostics Lsp-Modeline-Workspace-Status Lsp-Origami Lsp-Ui-Doc
Lsp-Ui Lsp-Ui-Sideline Origami Reftex Show-Smartparens Smartparens
Spacemacs-Leader-Override Spacemacs-Whitespace-Cleanup Tree-Sitter-Hl
Tree-Sitter Undo-Fu-Session Vi-Tilde-Fringe Yas
The major mode is LaTeX/FMPS mode defined in latex.el: I have just worked on a bigger latex presentation and it was definitely not slow on my small linux box though I have ended up with around 400 slides in the end. I am using texlab as lsp server which was working fine but did not use any preview feature instead I tend to have my PDF open in a second window and let the OS update it whenever I build. Here is my latex config: (latex :variables
latex-backend 'lsp
latex-enable-auto-fill t
latex-enable-magic nil
;; latex-view-with-pdf-tools t
latex-view-with-pdf-tools nil
latex-view-pdf-in-split-window t
latex-enable-folding t) @DrWaleedAYousef when you use my config and deactivate any global modes you have activated in your user config is the system still slow for you? Does switching from auctex to an lsp server help? |
Description
The general performance of Emacs gets very slow sometimes. This specifically happens with LaTeX and after opening the pdf and scrolling. The pattern is ambiguous. When it happens, it takes Emacs too much time to switch from window to window, scroll pdf, open or close the command buffer, etc.
Reproduction guide 🪲
Observed behaviour: 👀 💔
The slowness in response of Emacs
Expected behaviour: ❤️ 😄
Should be normal
System Info 💻
Backtrace 🐾
The text was updated successfully, but these errors were encountered: