3

When I use Emacs it seems fine mostly, but since recently every couple of minutes it becomes extremely slow for a while. When I change focus to another app, and come back after a while, it is invariably unresponsive for >10 seconds. Emacs is also very slow to boot now.

I ran the profiler and got this result:

       41175  94% - timer-event-handler
       41174  94%  - apply
       41102  94%   - savehist-autosave
       41100  94%    - savehist-save
       23713  54%     - savehist-printable
           4   0%        #<compiled -0x1c1d3aafa883aee7>
           4   0%       #<compiled -0x1c1d3ab2e57b90e7>
          64   0%   + auto-revert-buffers
           8   0%   + show-paren-function
           1   0%  + timer-activate-when-idle
        1859   4% + ...
         386   0% + command-execute
          65   0% + redisplay_internal (C function)
           3   0% + jit-lock--antiblink-post-command
           2   0% + winner-save-old-configurations

But savehist doesn't seem to have changed recently and it never gave me problems prior. What is happening, where do I go from here?

hraban
  • 211
  • 1
  • 9
  • Does https://emacs.stackexchange.com/questions/12086/high-cpu-memory-usage-and-abnormally-large-savehist-file help? – phils Aug 05 '21 at 22:13

1 Answers1

4

Check your history file: ~/.emacs.d/history. If it is very large (> 10 MB), quit Emacs, then delete it.

Credit to https://reddit.com/r/emacs/comments/5krh9b/long_emacs_pauses_how_to_troubleshoot_from_here/ (/u/UpInHarms)

hraban
  • 211
  • 1
  • 9
  • 1
    No, don't delete it. Rename it, figure out where the problem is, and fix it. https://emacs.stackexchange.com/questions/12086/high-cpu-memory-usage-and-abnormally-large-savehist-file – phils Aug 05 '21 at 22:05
  • @phils good point. In my case I knew the cause (accidental runaway C-u 1232314 paste), but if it's unexpected or keeps happening that should get investigated. – hraban Aug 06 '21 at 11:43