[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Speeding up Emacs load time
From: |
Sebastien Vauban |
Subject: |
Re: Speeding up Emacs load time |
Date: |
Thu, 25 Jul 2013 21:24:07 +0200 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (windows-nt) |
J. David Boyd wrote:
> "Sebastien Vauban" <sva-news@mygooglest.com> writes:
>> - `(server-start)' takes more than 200 ms to run [1]; just that one command.
>> Though, I must have it in my .emacs file, right?
>>
>> - diff-mode-.el must be loaded before diff-mode; hence, I must have it at
>> startup.
>>
>> - Helm is my tool for opening files or switching between buffers. Just
>> requiring `helm-config' (almost only autoloads) -- hence, NOT `helm' (which
>> is more hungry in time) -- already takes 160 ms (as it still requires
>> `easy-menu' and `helm-aliases').
>>
>> - `diary-lib' and co (needed for appointments notification) takes 233 ms.
>> Shouldn't I be notified at startup of events occurring in less than 15
>> minutes, without having to make a first call to calendar or so?
>>
>> - `mic-paren' takes just 32 ms, but for just one small package, for which I
>> don't have a particular trigger. Is it `find-file-hook'? Then, I won't
>> have
>> parenthesis highlighted when directly typing text in a newly created buffer
>> (or in the scratch). So, I need it in my .emacs. It's not
>> eval'ed-after-load
>> of something else.
>>
>> - The same for YASnippet (loaded in 130 ms): what would be the trigger?
>> Unless I have a clear one, I must require it in my .emacs file.
>>
>> - Once again, the same with `recentf', which takes 92 ms. Don't I have to
>> load
>> it right at startup?
>>
>> These are a couple of examples which take a lot of the time, and for which I
>> don't see a specific trigger that would allow me to defer their load to
>> later.
>
> How did you time those sections? Could you share, please?
The config file that I'm using is publicly available at
https://github.com/fniessen/emacs-leuven.
Note -- Put (setq leuven-load-verbose t) before loading it, and you'll get
load times, and call tree of the packages.
In summary, to time a package is done this way:
--8<---------------cut here---------------start------------->8---
;; make loaded files give a message
(defadvice load (around leuven-load activate)
"Execute a file of Lisp code named FILE and report time spent."
(let ((filename (ad-get-arg 0))
(find-file-time-start (float-time)))
(message "(info) Loading %s..." filename)
ad-do-it
(message "(info) Loaded %s in %.3f s." filename
(- (float-time) find-file-time-start))))
(defadvice require (around leuven-require activate)
"Leave a trace of packages being loaded."
(let* ((feature (ad-get-arg 0))
(require-depth (or (and (boundp 'require-depth) require-depth)
0))
(prefix (concat (make-string (* 2 require-depth) ? ) "+-> ")))
(cond ((featurep feature)
(message "(info) %sRequiring `%s'... already loaded"
prefix feature)
;; in the case `ad-do-it' is not called, you have to set the
;; return value yourself!
(setq ad-return-value feature))
(t
(let ((time-start))
(message "(info) %sRequiring `%s'... %s"
prefix feature
(locate-library (symbol-name feature)))
(setq time-start (float-time))
(let ((require-depth (1+ require-depth)))
ad-do-it)
(message "(info) %sRequiring `%s'... loaded in %.3f s"
prefix feature
(- (float-time) time-start)))))))
--8<---------------cut here---------------end--------------->8---
Though, do you have ideas for not being forced the above packages at startup
time? To which event (such as load of package "x") to which hook could I tie
them?
Best regards,
Seb
--
Sebastien Vauban
- Re: Speeding up Emacs load time, Eric Abrahamsen, 2013/07/01
- Re: Speeding up Emacs load time, Ken Goldman, 2013/07/14
- Re: Speeding up Emacs load time, Andrew Pennebaker, 2013/07/14
- Re: Speeding up Emacs load time, Peter Dyballa, 2013/07/15
- Message not available
- Re: Speeding up Emacs load time, Sebastien Vauban, 2013/07/24
- Re: Speeding up Emacs load time, J. David Boyd, 2013/07/24
- Message not available
- Re: Speeding up Emacs load time, Sebastien Vauban, 2013/07/25
- Re: Speeding up Emacs load time, J. David Boyd, 2013/07/25
- Message not available
- Re: Speeding up Emacs load time,
Sebastien Vauban <=
Message not available
Message not availableRe: Speeding up Emacs load time, Emanuel Berg, 2013/07/15
Re: Speeding up Emacs load time, Eli Zaretskii, 2013/07/15
Message not availableRe: Speeding up Emacs load time, Emanuel Berg, 2013/07/15
Re: Speeding up Emacs load time, Eli Zaretskii, 2013/07/15
Re: Speeding up Emacs load time, Ken Goldman, 2013/07/20
Message not availableRe: Speeding up Emacs load time, Rustom Mody, 2013/07/16