News for hackers. Stuff that matters.
Re:Emacs Is Not Just an Editor by SirensOfTitan on Sunday March 12, 2023 @10:49PM (#35130332)
Emacs is my daily driver, and even with JIT on an M1 mac I get a lot of stutter and freezes with LSP autocomplete. JIT definitely improved things [especially on my x86 machine], but I'm still unhappy with the slowness. Outside of LSP it's incredibly speedy.
Re:Emacs Is Not Just an Editor by Barrin92 on Sunday March 12, 2023 @11:08PM (#35130478)
I had the same issues with LSP and I switched to eglot and it's much less sluggish for me. I don't know why that is or if it's a general solution but worth giving a shot as eglot is built in I think in the newer versions.
Re:Emacs Is Not Just an Editor by trissylegs on Monday March 13, 2023 @02:36AM (#35131925)
Its because Emacs doesn't really have a way of performing asynchronous io. So lsp ends up blocking on the external server waiting for a reply.

It been the main pain point for addung smarter autocomplete for years now.

Re:Emacs Is Not Just an Editor by gpderetta on Monday March 13, 2023 @04:14AM (#35132617)
Emacs does have the ability to do non-blocking io though. Not sure if lsp-mode uses it and if not, why not.
Re:Emacs Is Not Just an Editor by unhammer on Monday March 13, 2023 @05:32AM (#35133242)
It actually does; support for async io has been there for ages. If you've ever compiled or run git push or run an external command like M-! sleep 10 & RET from Emacs, that's using async io. For things that end up calling an external command like that, the code will typically use `start-process` or `make-process`. For network io, there is `url-retrieve` with callbacks. For tasks that need to be run via emacs-lisp (e.g. sending emails, compiling elisp), there is John Wiegley's `async` library.

However, lots of packages simply don't use these affordances.

Also, for LSP, there's additional challenges since lots of json needs parsing for each request, but IIUC Emacs can't currently process the messages to/from the server while the UI thread is busy (the LSP server can do lots of work while UI is busy, but the communication is stalled until UI is done). Though it seems things will be improving there, hopefully this'll get upstreamed soon: https://www.reddit.com/r/emacs/comments/ymrkyn/async_nonbloc...