13

I have an org-mode file that's running around 6,000 lines with a hundred or so top-level headlines. It's started to take around a minute to load or save, and occasionally it sends emacs into the weeds and I have to force-quit it.

Do any of you think this is too big a file to handle practically in org-mode? Do you have experience with bigger files? Do you experience the same kinds of delays? Or should I be looking elsewhere for the causes of the slowness, like all the other emacs packages I have installed? Maybe I'm just asking too much of emacs in general.

This is with homebrew emacs 24.4 on Mac OS X Mavericks.

  • 2
    Are you using something else along with it, like linum-mode? What other special minor-modes are active (if any)? – lawlist Dec 14 '14 at 16:56
  • I have too many to list ... I started with emacs-live (the clojure toolbox) and have promiscuously loaded every interesting-looking package i could find in elpa and marmalade. I'm going to do a test with a bare emacs installation; if org-mode works ok then I will start bisecting my packages. Might be a good time to start over. – Reb.Cabin Dec 14 '14 at 17:10
  • 2
    This file is not too big to handle. I have experience with a 7000 line file github.com/grettke/home/blob/master/ALEC.org and very few headings. I don't experience load or save slowness. I get slow down when I collapse headings so I run with #+STARTUP: showeverything. You have the newest Emacs which comes with the newest org-mode. Start Emacs with emacs -Q and slowly add back packages to narrow down the offending package slowing things down. I'm on "24.4.1" and "8.2.10" emacs and org. – grettke Dec 14 '14 at 20:54
18

One of the less known features of Emacs is that it has a profiler! Let's assume your file is called foo.org, then you could do this:

M-xprofiler-start

C-x ffoo.org

M-xprofiler-report

After you've done all that Emacs will pop up a buffer with statistics on CPU usage (you can also choose to profile memory or both CPU and memory, when you start the profiler). This should give you some clues as to what functions take most time to execute.

  • It seems that if my buffer has more than 7k lines, it has tremendously long pauses. Do you know why that is so? – user8128167 Sep 5 '16 at 15:43
  • @user89861 My first guess would be fontification, but without trying to profile it's hard to tell. – wvxvw Sep 7 '16 at 14:02
  • OK, this is what I get for a profiler report: + timer-event-handler 408694 96% + command-execute 14634 3% + ... 1480 0% + redisplay_internal (C function) 183 0% + isearch-pre-command-hook 1 0% – user8128167 Sep 7 '16 at 20:02
  • @user89861 see if any of these two variables: stackoverflow.com/a/11670718/5691066 will give you a hint at what timer it was running. – wvxvw Sep 9 '16 at 17:58
3

I stripped every package out of my emacs environment, and now org-mode runs fine on my 6,000-line file.

Some other thing I had loaded was causing the problem. I will have to bisect my package installations to figure out what it is, but org-mode seems fine now.

  • Did a fresh install of emacs-live -- that wasn't causing the problems. – Reb.Cabin Dec 14 '14 at 17:49
  • If your question was answered satisfactorily and you don't need additional answers, please consider accepting your answer, so that this is removed from the list of unanswered questions. – Drew Dec 14 '14 at 17:57
  • @Drew -- There is a waiting period to accept one's own answer -- something like 36 or 48 hours. – lawlist Dec 14 '14 at 18:32
  • 1
    @lawlist: OK. But there is no waiting list on thinking over whether you might want to just delete the question because the Q&A might not be so helpful/interesting. ;-) – Drew Dec 14 '14 at 21:14
  • 3
    the question unearthed the interesting point about the profiler, so the question had a helpful side/effect :) – Reb.Cabin Dec 15 '14 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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