jwiegley / use-package

A use-package declaration for simplifying your .emacs
https://jwiegley.github.io/use-package
GNU General Public License v3.0
4.4k stars 260 forks source link

Use-package drastically increases load time #610

Closed treymerkley closed 6 years ago

treymerkley commented 6 years ago

I started using use-package because spaceline is a pain to work with without it. However, enabling it at least doubled my load time for Emacs, to around ~7 seconds, and the response time is slower than before. I think it has something to do with the Debian base system.

Here's my .init:

;; EMACS init script

;; Garbage
(setq gc-cons-threshold 64000000)
(add-hook 'after-init-hook #'(lambda ()
                               ;; restore after startup
                               (setq gc-cons-threshold 800000)))

;; load pathes for Git pulled packages
;;(add-to-list 'load-path "~/.emacs.d/sublimity/")
(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(setq package-enable-at-startup nil)
(package-initialize)

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(eval-when-compile
  (require 'use-package))
;; ;; EMACS auto shit

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(blink-cursor-blinks 10)
 '(blink-cursor-mode t)
 '(cua-mode t nil (cua-base))
 '(cua-normal-cursor-color "black")
 '(cursor-type (quote bar))
 '(custom-buffer-indent 4)
 '(custom-enabled-themes (quote (solarized)))
 '(custom-safe-themes
   (quote
    ("8db4b03b9ae654d4a57804286eb3e332725c84d7cdab38463cb6b97d5762ad26" default)))
 '(global-whitespace-mode nil)
 '(indent-guide-global-mode t)
 '(minimap-automatically-delete-window t)
 '(minimap-dedicated-window t)
 '(minimap-hide-fringes t)
 '(minimap-hide-scroll-bar t)
 '(minimap-highlight-line nil)
 '(minimap-mode t)
 '(minimap-width-fraction 0.05)
 '(minimap-window-location (quote right))
;; '(nil nil t)
 '(show-smartparens-global-mode t)
 '(smartparens-global-mode t)
 '(tabbar-background-color "#eee8d5")
 '(tabbar-mode t nil (tabbar))
 '(tabbar-mwheel-mode t nil (tabbar))
 '(tabbar-use-images t))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(minimap-font-face ((t (:height 20 :family "DejaVu Sans Mono"))))
 '(tabbar-button ((t (:inherit tabbar-default :foreground "#eee8d5" :box (:line-width 1 :color "#839496" :style released-button)))))
 '(tabbar-button-highlight ((t (:inherit tabbar-default :background "#fdf6e3"))))
 '(tabbar-default ((t (:inherit variable-pitch :background "#657b83" :foreground "#eee8d5" :height 0.8))))
 '(tabbar-highlight ((t (:underline "#93a1a1"))))
 '(tabbar-selected ((t (:inherit tabbar-default :foreground "#eee8d5" :box (:line-width 1 :color "white" :style pressed-button))))))

;;Setting line numbers
(global-linum-mode t)

;;Turning off splash screen and going straight to scratch
;;(setq inhibit-splash-screen t)
;;(switch-to-buffer "**")

;;Setting up transparency (off currently)
;;(set-frame-parameter (selected-frame) 'alpha '(<active> . <inactive>))
;;(set-frame-parameter (selected-frame) 'alpha '(100. 100))

;;ESS with Markdown
;;(require ’poly-R) (require ’poly-markdown)

;;Cursor mode
(setq-default cursor-type 'bar)

;;Loading everything that needs a startup
(add-hook 'emacs-startup-hook
      (lambda ()
    (load-theme 'solarized)
    ;(nyan-mode 1)
    (minimap-mode 1)
    ))
(add-hook 'prog-mode-hook #'indent-guide-global-mode)
(add-hook 'prog-mode-hook #'minimap-mode)

;;nyan mode
 (use-package nyan-mode
  :init
  :config
  (nyan-mode t)
  (nyan-toggle-wavy-trail)
  (nyan-start-animation))
   ;(nyan-animate-nyancat t)
   ;(nyan-animation-frame-interval 0.2)
   ;(nyan-cat-face-number 0)

;;Rainbow mode
(use-package rainbow-mode
  :ensure
  :config
  (add-hook 'prog-mode-hook 'rainbow-mode))

;; hideshow
(autoload 'hideshowvis-enable "hideshowvis" "Highlight foldable regions")

(autoload 'hideshowvis-minor-mode
 "hideshowvis"
 "Will indicate regions foldable with hideshow in the fringe."
 'interactive)

;;more hideshow
(add-hook 'prog-mode-hook 'hs-minor-mode)
(add-hook 'prog-mode-hook
      (lambda () (hs-minor-mode t)
                (hideshowvis-enable)
                (hideshowvis-symbols)
                )
      )

;; spaceline
(use-package spaceline :ensure t
  :config
  (setq-default mode-line-format '("%e" (:eval (spaceline-ml-main)))))

(use-package spaceline-config :ensure spaceline
  :config
  (spaceline-emacs-theme))

;; dashboard
(use-package dashboard
  :config
  (dashboard-setup-startup-hook)
  (setq dashboard-banner-logo-title "Welcome to Emacs Dashboard")
  (setq dashboard-startup-banner "~/.emacs.d/Emacs-icon128.png"))

;; diminish
(use-package diminish
  :ensure t
  :config
  (diminish 'rainbow-mode)
  (diminish 'hideshow-minor-mode)
  (diminish 'smartparens-mode)
  (diminish 'minimap-mode)
  (diminish 'indent-guide-mode)
  (diminish 'page-break-lines-mode)
  )

Here's the message area after launch:

Loading 00debian-vars...done
Loading /etc/emacs/site-start.d/50autoconf.el (source)...done
Loading /etc/emacs/site-start.d/50cmake-data.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading cua-base...done
Loading whitespace...done
Loading indent-guide...done
Loading minimap...done
Loading smartparens...done
Loading /home/trey/.emacs.d/elpa/tabbar-20160524.1401/tabbar.el (source)...done
Loading /home/trey/.emacs.d/recentf...done
Cleaning up the recentf list...done (0 removed)
For information about GNU Emacs and the GNU system, type C-h C-a.
jwiegley commented 6 years ago

Can you enable use-package-verbose, and then show me the load-time from that?

treymerkley commented 6 years ago

Sure. I installed a few new packages, so I'll put in the code with and without the packages that take a while.

With:

Loading package dashboard...
Configuring package dashboard...done
Loading package dashboard...done (0.752s)
Loading package diminish...
Configuring package diminish...done
Loading package diminish...done
[yas] Prepared just-in-time loading of snippets successfully.
Loading package ess...done (20.351s)
Loading package autopair...
Configuring package autopair...done
Loading package autopair...done
Loading /home/trey/.emacs.d/recentf...done
Cleaning up the recentf list...done (0 removed)
For information about GNU Emacs and the GNU system, type C-h C-a.

Without:

Loading package spaceline-config...done (3.015s)
Loading package dashboard...
Configuring package dashboard...done
Loading package dashboard...done (0.754s)
Loading package diminish...
Configuring package diminish...done
Loading package diminish...done
[yas] Prepared just-in-time loading of snippets successfully.
Loading package autopair...
Configuring package autopair...done
Loading package autopair...done
Loading /home/trey/.emacs.d/recentf...done
Cleaning up the recentf list...done (0 removed)
For information about GNU Emacs and the GNU system, type C-h C-a.

Additionally, the big new one that's causing problems I decided to defer with :defer t on it.

npostavs commented 6 years ago

Loading package ess...done (20.351s)

Is your Emacs version 24.5? Maybe this is the DNS hang triggered by (indirectly) loading tramp (see Emacs Bug#20015).

jwiegley commented 6 years ago

@treymerkley Do you still think the problem lies with use-package?

treymerkley commented 6 years ago

@jwiegley I don't think so, I think one of my other packages that I enabled at around the same time was making a lot of unnecessary system calls. I replaced the worst offenders and am going to compile from the latest release on GNU's website. It isn't perfect, but it's good enough for me. Thanks!

jwiegley commented 6 years ago

If you notice anything I can help with, please, do come back.