5 ms·
Would love to use emacs but for my use case everytime I open a relatively big json file it takes couple of sends until emacs is usable while lsp and other plugi
by rs_rs_rs_rs_rs 4y ago
Would love to use emacs but for my use case everytime I open a relatively big json file it takes couple of sends until emacs is usable while lsp and other plugins run on it. I keep hitting these annoying lags when I can't use the tool for 1-2 seconds while something runs.
Is this something I could avoid or it's unavoidable since Emacs is single threaded?
Using Doom Emacs at the moment.
- pjm331 4y agoHave you tried the eglot package for LSP instead of lsp-mode? Can toggle it on with +eglot flag for lsp module in your doom config I was having the same issues and that solved it for me
- TacticalCoder 4y agoWhat is your hardware? How fast is your Emacs? Ryzen 3700K here: time emacs -nw -Q -eval '(kill-emacs)' <- no GUI, no config file at all 0.086s in my case (86 milliseconds) and I think that's relatively slow compare to machines others have here (5900X / 12th gen Intel / M1 macs etc.). Then: time emacs -eval '(kill-emacs)' 1.4s (loading a very big custom Emacs setup). Are you using the native-comp branch of Emacs? Are you using a native JSON parsing lib? (not sure if it helps to open JSON files themselves but it speeds up LSP greatly, for LSP uses JSON files). > Is this something I could avoid or it's unavoidable since Emacs is single threaded? I don't know about gigantic JSON files but that's very weird to me: I can start working on my Clojure files while LSP is starting. And LSP is definitely starting in another process that is not blocking the Emacs thread. Emacs may use a single kernel thread but there are lots of things that are done by external processes. I'm not saying there aren't things that can block Emacs but, in my case, although LSP is still slow to start up, it's definitely not blocking my Emacs (top, for example, shows clojure-lsp running as its own process). I'm using Emacs since decades and it has never felt faster than nowadays: newer hardware, NVMe SSD, native-compilation branch, integration of ripgrep and fzf (two amazing helper tools that are insanely fast) through ivy/counsel (counsel-rg / counsel-fzf)... Cherry on top: I now get the LSP servers and although it's not IntelliJ yet, it's much better than any "Emacs" I used in the past.
- rs_rs_rs_rs_rs 4y agoI do have a relatively old processor, i5-4460, but it's not THAT old, fast SSD. I'm only using the nativecomp branch and doom-emacs starts in 1.4 seconds here too. Someone suggested eglot instead of lsp-mode, will give that a try.
- danhor 4y agoYou could not load some modes if the file you're loading is large, in the somewhat extreme case fundamental-mode usually performs fine.
- arc-in-space 4y agoLarge files are an eternal issue with emacs, typically I open them with 'find-file-literally' to disable the more expensive modes.
- natrys 4y agoDisable lsp if you don't need it? That said, big slowdowns are also usually down to syntax highlighting. You can either disable that, or better yet switch from the old font-lock method to new tree-sitter based one. Here is a recent thread you might find useful: https://old.reddit.com/r/emacs/comments/u4q2wl/treesitter_highlighting_rocks/ https://old.reddit.com/r/emacs/comments/u4q2wl/treesitter_hi...
- stnmtn 4y agoReading the replies to this is very humorous when you contrast it with the usual hacker news replies whenever someone mentions VSCode, complaining about how electron is slow and buggy, when comparitvely VSCode is lightning fast compared to emacs and doesn't require intimate knowledge about emacs internals to simply open a large json file.