diff options
-rw-r--r-- | init.el | 34 |
1 files changed, 28 insertions, 6 deletions
@@ -20,6 +20,34 @@ (setq-default initial-scratch-message (concat ";; Happy hacking, " user-login-name " - Emacs loves you!\n\n")) +(defvar before-user-init-time (current-time) + "Value of `current-time' when Emacs begins loading `user-init-file'.") + +;;; Garbage Collector +(progn + ;; Set this to true to find GC issues. + (setq garbage-collection-messages nil) + + ;; Increase the gc-cons-threshold to a very high number to decrease + ;; the load and compile time. The value will be decreased + ;; significantly after initialization to avoid long GC pauses during + ;; normal usage. + (setq gc-cons-threshold 402653184 + gc-cons-percentage 0.6) + + ;; Reset GC to normal values. + (add-hook 'emacs-startup-hook + (lambda () + (message + "[STARTUP] Loading %s...done (%.3fs)" user-init-file + (float-time (time-subtract (current-time) + before-user-init-time))) + + (when init-file-debug + (message "Rolling back GC settings to sane values.")) + (setq gc-cons-threshold 16777216 + gc-cons-percentage 0.1)))) + ;;; Modules directory (push (concat user-emacs-directory "modules") load-path) @@ -98,12 +126,6 @@ (when (file-exists-p custom-file) (load settings-file)) -;; Time Output -(when window-system - (let ((elapsed (float-time (time-subtract (current-time) - emacs-load-start-time)))) - (message "[STARTUP] Loading %s ... done (%.3fs)" load-file-name elapsed))) - ;; enable erase-buffer command (put 'erase-buffer 'disabled nil) |