1

Emacs startup time on Linux is 2.3 seconds. When I exit Emacs with C-xC-c, it quits instantly. This changes when I put only the following lines in my configuration:

(setq savehist-file (concat user-emacs-directory "savehist"))
(savehist-mode 1)

Then when starting Emacs, it took 4.5 seconds to start. That's nearly the double of the old startup time.

And when I quit Emacs, it tooks some time. I see only the message wrote /home/ReneFroger/Dropbox/Emacs/places before it finally quits.

I'm wondering which the savehist feature is consuming so much time? I didn't had this problem earlier.

  • 2
    How big is your ~/.emacs.d/history file? (or whatever savehist-file is set to). Have you by any chance set history-length to be enormous? (compared to its default of 100). Or added some huge vars to savehist-additional-variables? In any case emacs.stackexchange.com/q/12086/454 might help. – phils Dec 9 '15 at 20:46
  • 1
    Let us know whether that's a duplicate? Failing that, does the performance improve if you move your config outside of the Dropbox directory? (I've heard of people having performance problems with Dropbox before.) – phils Dec 9 '15 at 20:57
  • 1
    This may be related: emacs.stackexchange.com/questions/4187/…. – PythonNut Dec 10 '15 at 23:06
  • 1
    @PythonNut, I see. I opened it, and I see Elisp all the way from my init.el configuration and some history. I decided to delete it and start again with brandnew savehist. Now it gets fast again. But I still not understand why it was related to writing places, but it's solved. PythonNut, you helped me again and I really appreciate your support! – ReneFroger Dec 12 '15 at 22:19
  • 1
    ReneFroger: A very large savehist file is exactly what my comments were about, which means that this is indeed a duplicate of the Q&A I linked to. Please look at the answer to that question to see how you might determine the exact culprit in that situation, and what you could do about it. – phils Dec 14 '15 at 20:59
3

The problem you experienced is unrelated to the /home/ReneFroger/Dropbox/Emacs/places file.

Essentially, your savehist-file is becoming too large. Every time you close Emacs, it serializes the variables storing minibuffer histories along with any other variables of your choosing and writes it to the file. When you start Emacs, it does the reverse, reading the file, parsing it's contents, and reconstructing the state.

28,622,699 bytes is a lot of data. It may not sound like much, but serialization and parsing isn't a cheap operation, and therefore it takes a good bit of time to convert.

The temporary solution is to delete the savehist-file, but that only delays future bloat.

Usually, this is caused by some abnormal configuration. (history-length is too large, or too many variables are being saved, for example), and you'll need to investigate to determine why savehist is being directed to store all this data.

| improve this answer | |

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