this post was submitted on 30 Oct 2023
0 points (50.0% liked)

Emacs

305 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

I've been looking for methods to improve Emacs performance especially with my configuration being over >3k. I'm not particularly interested in startup-time since I never close Emacs. Here's what I found so far

(setq package-native-compile                            t
      gcmh-high-cons-threshold                          100000000
      gc-cons-threshold                                 100000000
      scroll-conservatively                             101
      jit-lock-defer-time                               0
      large-file-warning-threshold                      nil)



(add-hook 'after-init-hook #'(lambda () (setq gc-cons-threshold (* 100 1000 1000))))
(defvar gc-timer nil)
(defun salih/maybe-gc ()
  (let ((original gc-cons-threshold))
    (setq gc-cons-threshold 800000)
    (setq gc-cons-threshold original
          gc-timer (run-with-timer 2 nil #'salih/schedule-maybe-gc))))

(defun salih/schedule-maybe-gc ()
  (setq gc-timer (run-with-idle-timer 2 nil #'salih/maybe-gc)))

(salih/schedule-maybe-gc)

I can tell that I've noticed some improvements.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 10 months ago (1 children)

I've focused on what I really need and avoid cluttering my config. I've spent considerable time understanding what performs well and what doesn't. I try to minimize the use of global modes and refrain from installing additional packages if built-in ones do the job. I'm very discerning when it comes to choosing any new package. Essentially, I have to "sell" myself on a new package, if you know what I mean. Yes, I do use byte-compilation for Lisp code and feel that I've managed to make things quite efficient and clean. You can take a look and borrow any solutions from my setup here: https://github.com/sergeyklay/.emacs.d

[–] [email protected] 1 points 10 months ago

With the new --init-directory switch of Emacs 29, you can define a completely separate environment for Emacs that could be used to make more mean, lean and specialized versions of Emacs. For example, instead of having your Emacs do everything, IRC, email, programming, Org mode stuff etc. etc. etc. you could have a shell command invoking each one, e.g. Eirc, Eemail, Eorg, etc.