1
0
mirror of https://github.com/Foltik/dotfiles synced 2024-11-24 04:22:50 -05:00

Add GC optimizations

This commit is contained in:
Jack Foltz 2019-02-10 14:34:50 -05:00
parent 659984a9ad
commit eea3302ce3
No known key found for this signature in database
GPG Key ID: E7B502AB1576E6CD
2 changed files with 26 additions and 2 deletions

View File

@ -354,6 +354,14 @@ Print more stuff when running =C-x C-e= or =(eval-last-sexp)=
#+BEGIN_SRC emacs-lisp
(setq eval-expression-print-level 100)
#+END_SRC
*** GC in Minibuffer
Don't garbage collect while the minibuffer is open, as heavy
things like completion and searches are happening and will
slow down with many garbage collections.
#+BEGIN_SRC emacs-lisp
(add-hook 'minibuffer-setup-hook #'jf-inhibit-gc)
(add-hook 'minibuffer-exit-hook #'jf-resume-gc)
#+END_SRC
** UI
*** Font
Engage a nice coding font.
@ -414,7 +422,10 @@ Show a cool custom dashboard buffer on startup.
:custom
(dashboard-startup-banner 'logo)
(dashboard-banner-logo-title "Welcome to Electronic Macs")
(dashboard-banner-logo-title
(format "Welcome to Electronic Macs. Ready in %.2f seconds with %d GCs."
(float-time (time-subtract after-init-time before-init-time))
gcs-done))
(dashboard-items
'((recents . 5)
(agenda)

View File

@ -4,6 +4,19 @@
(defvar jf-config-file (expand-file-name "config.org" user-emacs-directory))
(defvar jf-init-file (expand-file-name "init.el" user-emacs-directory))
(defvar jf-load-path (expand-file-name "lisp/" user-emacs-directory))
(defvar jf-gc-threshold 20000000) ; 20MB up from 800KB
(message "Initializing Electronic Macs...")
(defun jf-inhibit-gc ()
(setq gc-cons-threshold most-positive-fixnum))
(defun jf-resume-gc ()
(setq gc-cons-threshold jf-gc-threshold))
(message "-> Initializing Electronic Macs...")
;; Don't garbage collect during init
(jf-inhibit-gc)
(org-babel-load-file jf-config-file)
(jf-resume-gc)
(message "-> Initialized in %s" (emacs-init-time))