1. 36
  1. 17

    Its package ecosystem is in excellent condition and packages such as org-mode and eglot / lsp-mode make even the most demanding programming languages a joy to work with in Emacs.

    I work on a large C/C++ codebase as part of my day job and use lsp-mode/eglot (currently eglot) to navigate the code, with very few extensions. I also use the latest mainline Emacs with native compilation. I have been using Emacs for over 25 years and my customization is best categorized as “very light”. In short, my Emacs set up is not much beyond what ships with it.

    And it’s still just… slow. GCC has some pretty big files and opening them can take up to 10 seconds thanks to font-lock mode. (Yes, I know I can configure it to be less decorative, but I find that decoration useful.) It’s much worse when you open a file that is the output from preprocessor expansion (easily 20000+ lines in many cases).

    Log files that are hundreds of megabytes are pretty much a guaranteed way to bring Emacs to a crawl. Incremental search in such a buffer is just painful, even if you M-x find-file-literally.

    I had to turn off nearly everything in lsp-mode/eglot because it does nothing but delay my input. I can start typing and it will be 3-4 characters behind as it tries to find all the completions I’m not asking for. Company, flymake, eldoc are all intolerably slow when working with my codebase, and I have turned them all off or not installed them in the first place.

    M-x term is really useful, but do not attempt to run something that will produce a lot of output to the terminal. It is near intolerable. Literally orders of magnitude slower to display than an xterm or any other terminal emulator. (M-x eterm is no better.)

    The problem, of course, is that Elisp is simply not performant. At all. It’s wonderfully malleable and horribly slow. It’s been this way since I started using it. I had hopes for native compilation, but I’ve been running it for a few months now and it’s still bad. I love Emacs for text editing and will continue to use it. I tried to make it a “lifestyle choice” for a while and realized it’s not a good one if I don’t want to be frustrated all the time. Emacs never seems to feel fast, despite the fast hardware I run it on.

    1. 6

      The performance was the reason for me to leave Emacs. I was an evil mode user anyways so the complete switch to (neo)Vim was simple for me. I just could not accept the slowness of Emacs when in Vim everything is instant.

      E.g. Magit is always named as one of the prime benefits of Emacs. While its functionality is truly amazing its performance is not. Working on a large code base and repository I was sometimes waiting minutes! for a view to open.

      1. 3

        What did you find slow on Emacs aside from Magit?

        I actually use Emacs because I found it really fast compared to other options. For example, the notmuch email client is really quick on massive mailboxes.

        Some packages might be slow, though. I think the trick is to have a minimal configuration with very well chosen packages. I am particularly interested in performance because my machine is really humble (an old NUC with a slow SATA disk).

        1. 2

          To be fair it was some time ago and I don’t remember all the details but using LSPs for code completion/inspection was pretty slow e.g.

          Compared to IDEs it might not even have been slow but similar. I however have to compare to Vim where I have equal capabilities but pretty much everything is instant.

          My machine was BTW pretty good hardware.

          1. 1

            lsp-mode became much more efficient during the last year or so. Eglot is even more lightweight, I think. Perhaps it is worth giving it another go.

            I think there was some initial resistance to LSP in the Emacs community and therefore they were not given the attention they deserve.

            1. 2

              Thanks for the notice! I may try it again in the future but currently I am very happy with my Neovim setup, which took me a long time to setup/tweak :)

        2. 2

          Out of curiosity, were you using Magit on Windows?

          I use Magit every day and my main machine is very slow. (1.5GHz 4 core cortex A53) Magit never struck me as particularly slow, but I’ve heard that on Windows where launching subprocesses takes longer it’s a different story.

          1. 3

            but I’ve heard that on Windows where launching subprocesses takes longer

            Ohh you have no idea how slow in a corporate environment. Going through MSYS2, Windows defender, with windows being windows and a corporate security system on top, it takes… ages. git add a single file? 20 seconds. Create a commit? Over a minute. It’s bonkers if you hit the worst case just right. (On a private Windows install, MSYS2 + Exceptions set in Windows Defender it’s fine though, not much slower as my FreeBSD laptop) I asked around and there is a company wide, hardcoded path on every laptop, that has exceptions in all the security systems just to make life less miserable for programmers. Doesn’t solve it completly, but helps.

            Either wait an eternity or make a mokery of the security concept. Suffice to say I stopped using Windows and Cross-Compile from now on.

            1. 1

              Can confirm. I use Magit on both Linux and Windows, and it takes quite a bit of patience on Windows.

              1. 1

                With Windows I think it’s it’s particularly git that is slow, and magit spawns git repeatedly. It used also to be very slow on Mac OS as well because of problems with fork performance. On linux, it used to be slow with tramp. There are some tuning suggestions for all of these in the magit manual I think.

                1. 1

                  Nope on Linux. As mentioned our code base is big and has many branches etc. Not sure where exactly Magit’s bottleneck was. It was quite some time ago. I just remember that I found similar reports online and no real solution to them.

                  I now use Lazygit when I need something more than git cli and it’s a fantastic tool for my purpose. I also can use it from within Vim.

                2. 1

                  Working on a large code base and repository I was sometimes waiting minutes! for a view to open.

                  This happens for me as well with large changes. I really like Magit but when there are a lot of files it’s nearly unusable. You literally wait for minutes for it to show you an update.

                3. 4

                  I know you’re not looking to customise much but wrt. terminals, vterm is a lot better in that regard.

                  1. 1

                    I actually switched to M-x shell because I found the line/char mode entry in term-mode to be annoying (and it seems vterm is the same in this respect). shell-mode has all the same slowness of term-mode, of course. I’ve found doing terminal emulation in Emacs to be a lost cause and have given up on it after all these years. I think shell-mode is probably the most usable since it’s more like M-x shell-command than a terminal (and that’s really its best use case).

                    1. 1

                      If you need ansi/curses there’s no good answer and while I like term it was too slow in the end and I left. I do think that for “just” using a shell that eshell is fine though.

                  2. 3

                    Do you use the jit branch of emacs? I found once I switched to that and it had jit compiled things my emacs isn’t “fast” but its pretty boring now in that what used to be slow is now at least performant enough for me not to care.

                    1. 2

                      Is there a brew recipe or instructions on compiling on Mac? Or does checking out the source and running make do the business?

                      1. 3

                        I use the emacs-plus1 package. it compiles the version you specify. currently using emacs-plus@29 with --with-native-comp for native compilation, and probably some other flags.

                        1. 2

                          Thanks again, this is appreciably faster and I’m very pleased 😃

                          1. 2

                            Awesome! also, check out pixel-scroll-precision-mode for the sexiest pixel-by-pixel scrolling. seems to be a little buggy in info-mode, can’t replicate with emacs -Q though, so YMMV.

                          2. 1

                            Thank you that sounds perfect

                          3. 1

                            I’m a Mac user and I found it very hard to compile Emacs.

                            This might be a good starting point however:

                            https://github.com/railwaycat/homebrew-emacsmacport

                            1. 1

                              I honestly don’t know I use nix+home-manager to manage my setup on macos, this is all I did to make it work across nixos/darwin:

                              Added it as a flake input: https://github.com/mitchty/nix/blob/7e75d7373e79163f665d7951829d59485e1efbe2/flake.nix#L42-L45

                              Then added the overlay nixpkgs setup: https://github.com/mitchty/nix/blob/7e75d7373e79163f665d7951829d59485e1efbe2/flake.nix#L84-L87

                              Then just used it like so: https://github.com/mitchty/nix/blob/6fd1eaa12bbee80b6e80f78320e930d859234cd4/home/default.nix#L87-L90

                              I gotta convert more of my config over but that was enough to build it and get my existing ~/.emacs.d working with it and speedy to the point I don’t care about emacs slowness even on macos anymore.

                            2. 1

                              Do you use the jit branch of emacs?

                              Yes. I’ve been using the libgccjit/native compilation version for some time now.

                            3. 2

                              The problem, of course, is that Elisp is simply not performant.

                              That’s half of it. Another half is that, IIRC, Emacs has rather poor support for asynchrony: most of elisp that runs actually blocks UI.

                              1. 1

                                In short, my Emacs set up is not much beyond what ships with it.

                                Can share your config? I’m curious to know how minimal you made it.

                                1. 1

                                  Here you go. It changes a little bit here and there with some experiments.The packages I currently have installed and use are: which-key, fic-mode, counsel, smartparens, magit, and solarized-theme. There may be a few others that I was trying out or are only installed for some language support (markdown, yaml, and so forth).

                                  1. 1

                                    Thank you very much.

                                  2. 1

                                    Quick addendum on the config: that’s my personal config, which morphs into my work setup. My work one actually turns off flymake and eldoc when using eglot.

                                  3. 1

                                    Is there anything that has prevented a Neovim-style rewrite of Emacs? A Neomacs?

                                    I keep hearing about the byzantine C-layer of Emacs and the slowness of Elisp. And Emacs definitely has the community size to develop such an alternative. Why do you think no one has attempted such an effort? Or maybe I should add “recently” to the question. As I know there are other Emacs implementations.

                                    1. 4

                                      As crusty as Emacs source can be, it’s nowhere near as bad Vim source was, which was a rat’s nest of #ifdef. That’s why Neovim had to basically rewrite their way to a fork. The Emacs implementation is surprisingly clean, as long as you can tolerate some of the aged decisions (and GNU bracing).

                                      1. 2

                                        There is Climacs, which isn’t exactly the same, but is close.

                                        The problem for any new Emacs clone will that it has to run all the Elisp out there. Unless there is a substantial speed improvement to Elisp or a very good automatic translation tool, any such project will be doomed from the start.

                                    2. 6

                                      I feel guilty… I use emacs all day every day….

                                      But I have contributed very little back.

                                      Anyone have a “how to contribute to emacs and emacs packages tutorial”?

                                      1. 5

                                        I think you just answered yourself how to contribute :)

                                        1. 2

                                          Alas, I can tell you how to use it… I haven’t a clue as to what is the standard pull request process for things in Melpa or if there even is one or for any of the standard packages.

                                          Hmm. This exists… https://www.gnu.org/software/emacs/CONTRIBUTE

                                        2. 1

                                          Check the file CONTRIBUTE in the Emacs sources; it’s meant to be that guide.

                                          There’s an old article by Lars Ingebrigtsen (co-maintainer): https://lars.ingebrigtsen.no/2014/11/13/welcome-new-emacs-developers/

                                          [edit: fixed location of the CONTRIBUTE file]

                                        3. 3

                                          I used to use projectile for all the reasons the author mentioned until a couple weeks ago where I decided to try project.el, the built-in support for project management. It doesn’t have all the same features, but it has the most important ones (find file/buffer in project) and ripgrep has a “ripgrep-project” command or similar that uses project.el. Apparently it’s much better now than it used to be.

                                          Not that I’m saying that either option is superior, of course, just wanted to mention it exists.

                                          1. 1

                                            This is a nice writeup. I am reaching 30 years with Emacs this spring, and I’ve adopted pretty much all of these packages.