I'm a former vim user that switched to emacs + evil with a still relatively simple configuration with only 36 packages. I'm really happy with the additional functionality emacs delivers, but one thing bothers me really much. Emacs is much slower when working and editing large files than vim. For example when I try to delete many lines with the "d NUMBEROFLINES d" in the magnitude of 10.000 or more emacs will freeze for some time. The same problems occurs when I try to select a large amount of lines in visual mode in similar magnitudes. In vim these things work almost immediately. I think that these performance issues are related to how emacs displays and edit text. My question is if there are any options or packages to work around these bottlenecks?


After profiling the garbage collection (automatic gc) seems to be the source of problem. It uses up to 97% of CPU when I try to higlight a large region of text. Activating fundamental-mode and deactivating evil-mode doesn't have any effect on this.

  • If you don't use evil, is it any different? What about in fundamental-mode (with and without evil). Which mode is being used normally? Have you tested under emacs -Q? When it's slow, what does the profiler tell you? C-h i g (elisp)Profiling
    – phils
    Commented Oct 29, 2020 at 11:54
  • You're basically asking for packages that "make Emacs faster". That's much too vague. Please make your question more specific. E.g. ask how to figure out where the performance problem comes from.
    – Stefan
    Commented Oct 29, 2020 at 13:25
  • I am not 100%sure if this works for you but there is a program called joe editor which works blazingly fast with large files. Open an eshell buffer and type joe filename. You can edit large files in this way. Or even better call vim :-) Commented Oct 29, 2020 at 17:15

3 Answers 3



  1. M-x profiler-start and select cpu from the prompt

  2. do the thing that is slow

  3. M-x profiler-stop

  4. M-x profiler-report

  5. Look for the cpu hogs and drill down in to them by hitting TAB on them to find what's slowing down your Emacs.

Also consider using so-long, which is now part of Emacs (as of Emacs version 27).

  • Thank your for the fast respond. The problem seems to be automatic gc. I will look further into it
    – enco909
    Commented Oct 30, 2020 at 12:16
  • 1
    Try: (setq gc-cons-threshold (* 100 1024 1024))
    – izkon
    Commented Oct 31, 2020 at 23:10

Via using profiler above (thx), I found that in my case performance issue occurred seemingly due to this

(global-linum-mode t)

Clearly not advisable to have it on globally (i.e. if ever wanting to open large file)


One common source of problems with large files is font locking/syntax highlighting. As a quick check, you can turn it off by switching to fundamental mode (i.e., M-x fundamental-mode). When you do this, you should see all the text in the buffer displayed in the same, default font with no colouring or other decoration.

If that solves your performance issue, you'll want to set up your config to disable font-locking on files of the type that are giving you problems. That will depend on details you haven't shared yet.

  • Thank your for the quick answer. Unfortunatly that doesn't solve the performance issues.
    – enco909
    Commented Oct 30, 2020 at 12:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.