5

I can't remember since when exactly, but Emacs is getting slow with basic operations (moving cursor around). It's not exactly slow, but feeling laggy.

Before I try and halven my configuration files step by step as suggested in many places, I was wondering if there was another way.

Here is what profiler-report says:

- ...                                   433  36%
   Automatic GC                         406  34%
 + helm-check-minibuffer-input           22   1%
 + company--perform                       3   0%
 + byte-compile-let                       1   0%
 + sp-skip-closing-pair                   1   0%
- command-execute                       426  36%
 - call-interactively                   426  36%
  + helm-M-x                            287  24%
  + next-line                           103   8%
  + previous-line                        16   1%
  + save-buffer                          10   0%
  + kill-ring-save                        3   0%
  + windmove-up                           3   0%
  + windmove-down                         2   0%
  + yank                                  1   0%
  + self-insert-command                   1   0%
- timer-event-handler                   153  13%
 - byte-code                            148  12%
  - apply                               148  12%
   + mouse-avoidance-fancy              112   9%
   + auto-revert-buffers                 21   1%
   + hl-paren-highlight                   4   0%
   + #<lambda 0x72a5c9c7f6e60>            1   0%
     jit-lock-context-fontify             1   0%
   + blink-cursor-start                   1   0%
   + company-echo-show                    1   0%
 + timer-activate-when-idle               2   0%
 + timer-inc-time                         2   0%
+ redisplay_internal (C function)        87   7%
+ delete-selection-pre-hook              45   3%
+ flycheck-error-list-highlight-errors   19   1%
  x-set-selection                         5   0%
+ deactivate-mark                         2   0%
+ flycheck-display-error-at-point-soon    2   0%
+ yas--post-command-handler               1   0%

I can't really identify what gives me that laggy feel, especially since I am merely moving point around.

Mathieu Marques
  • 1,953
  • 1
  • 13
  • 30

1 Answers1

2

Something you might try is increasing gc-cons-threshold - with packages like helm, they need more memory or might get slowed down - note that the garbage collector and helm take up most of your CPU time.

But if you set it too high, Emacs would freeze for some seconds when it finally garbage collects.

The default is 800kb - Spacemacs uses 100mb, so that's what I've been using -

(setq gc-cons-threshold 100000000) ; ie 100mb, default is 800kb

See also https://www.reddit.com/r/emacs/comments/41m7x3/why_are_you_changing_gcconsthreshold/

Brian Burns
  • 1,577
  • 14
  • 15