0

I have a large text file that's over 8 MB. I can't really open it in desktop Emacs since it takes at least 30 seconds just to open the file via find-file, and it takes like 10 seconds for the screen to refresh appropriately when scrolling just one line or so. I tried setting the mode to fundamental, copying the whole text from the large file I mentioned that's opened in Sublime Text 2, and pasting to the emacs' buffer, and the text didn't show in 30 seconds so I killed the whole process. In Sublime Text 2, on the other hand, it just took 2 seconds to paste the whole text to another text file.

This doesn't happen in the terminal version of Emacs. Nor in other similar text editors like Atom or Sublime Text 2.

My Emacs: 24.5 (9.0) for OS X desktop.

stacko
  • 1,577
  • 1
  • 11
  • 18
  • As you're using OSX, which seems to be notorious for causing people to inadvertently run Emacs 22 from the command line, can you please start emacs in the terminal and then check `M-x emacs-version` – phils May 06 '17 at 13:16
  • @phils, so does this happen only in my environment? It says 24.5.1. I thought this was a common issue because I saw questions on how to make emacs handle large files faster and the typical answers are open such files in fundamental mode and disable linum mode. – stacko May 06 '17 at 14:48
  • 1
    Try it with no init file (emacs -Q). Same issue or not? – Dan May 06 '17 at 15:07
  • This isn't normal - I regularly work with a text file ~3MB with short delays (1-2 seconds lag every 10-20 min). Nothing like what you describe. The problem could be on the Emacs side, or an interaction between the Emacs GUI and your operating system. If the problem goes away when you load emacs with the `emacs -Q` option, then it's something you can fix by [working through your init file](https://emacs.stackexchange.com/questions/28429/how-do-i-troubleshoot-emacs-problems/28430#28430). If the problem persists, it's something at the OS level that may be trickier to sort out. – Tyler May 06 '17 at 16:25
  • See @Dan's comment. That's the first thing to check, to see if something in your init file is the culprit. If not, provide a minimal, step-by-step recipe to repro the problem, starting with `emacs -Q`. – Drew May 06 '17 at 16:55
  • Does the file have long lines? – npostavs May 06 '17 at 18:09
  • @Tyler, I couldn't run "Applications/Emacs.app/Contents/MacOS/Emacs -Q" from Terminal, so instead I ran "Applications/Emacs.app/Contents/MacOS/Emacs --no-init-file", and I managed to open the file in question but it took like 45 seconds. Is this weird? – stacko May 06 '17 at 21:31
  • @Tyler, and you said you did have short delays with ~3MB files and it's something that doesn't happen in other editors like Sublime Text 2 or Atom, right? Why is only Emacs slow with large files?? – stacko May 06 '17 at 21:32
  • Very long lines can be an issue in Emacs. What does `awk '{print length}' "NAME_OF_FILE" | sort -nr | uniq -c | head` show? – phils May 07 '17 at 00:26
  • You can also use the built-in profiler to learn where the cpu time is being used. See `C-h i g (elisp)Profiling` – phils May 07 '17 at 00:29
  • As you've confirmed that you're using the same version of Emacs in both the terminal and GUI cases, and this issue only occurs with GUI Emacs (you said there is no comparable slowness when running it in the terminal), I would hazard a guess that there may be some fancy graphical character display issues going on. If you can provide (or show how to generate) a sample file exhibiting the issue for `emacs -Q` then, you could `M-x report-emacs-bug` – phils May 07 '17 at 00:43
  • I don't use any other editors, so I don't know if Emacs is slow compared to anything else. My big file is a bibtex database, and the slowness there is related to some particular packages I use. In general there should be no problems with files this size – Tyler May 07 '17 at 01:37

0 Answers0