unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org
Subject: Re: Speeding up Emacs load time
Date: Thu, 25 Jul 2013 21:24:07 +0200	[thread overview]
Message-ID: <861u6mh294.fsf@somewhere.org> (raw)
In-Reply-To: mailman.1762.1374762058.12400.help-gnu-emacs@gnu.org

J. David Boyd wrote:
> "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org> 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


  parent reply	other threads:[~2013-07-25 19:24 UTC|newest]

Thread overview: 110+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAHXt_SU8+n5JaupmrnDaSirc+yzBRGQAmOWgRpb=uEkaGAR9Sg@mail.gmail.com>
     [not found] ` <CAHXt_SUL6a0q0q5nbJ3aw301C2--85e_Q3vVvPA7yxMvPbJ5mQ@mail.gmail.com>
2013-06-25 23:06   ` Speeding up Emacs load time Andrew Pennebaker
2013-06-26  2:02     ` Hongxu Chen
2013-06-26  7:30       ` Didier Verna
2013-06-26 17:04     ` J. David Boyd
2013-06-26 17:15       ` Mihamina Rakotomandimby
2013-07-15  1:02       ` Ken Goldman
2013-07-15  1:33         ` Andrew Pennebaker
2013-07-15  6:20           ` Glyn Millington
2013-07-15  8:15             ` Rasmus
2013-07-15  8:05           ` Peter Dyballa
     [not found]           ` <mailman.1066.1373869854.12400.help-gnu-emacs@gnu.org>
2013-07-24 20:50             ` Sebastien Vauban
2013-07-24 21:22               ` J. David Boyd
     [not found]               ` <mailman.1720.1374700982.12400.help-gnu-emacs@gnu.org>
2013-07-25  7:25                 ` Sebastien Vauban
2013-07-25 14:20               ` J. David Boyd
     [not found]               ` <mailman.1762.1374762058.12400.help-gnu-emacs@gnu.org>
2013-07-25 19:24                 ` Sebastien Vauban [this message]
     [not found]         ` <mailman.1061.1373851999.12400.help-gnu-emacs@gnu.org>
2013-07-15 14:06           ` Emanuel Berg
2013-07-15 14:45             ` Peter Dyballa
2013-07-15 15:46             ` Eli Zaretskii
2013-07-15 16:08               ` J. David Boyd
     [not found]             ` <mailman.1105.1373903184.12400.help-gnu-emacs@gnu.org>
2013-07-15 17:00               ` Emanuel Berg
2013-07-15 18:29                 ` Eli Zaretskii
     [not found]                 ` <mailman.1117.1373913021.12400.help-gnu-emacs@gnu.org>
2013-07-15 19:49                   ` Emanuel Berg
2013-07-16  2:38                     ` Eli Zaretskii
2013-07-20 22:08                       ` Ken Goldman
     [not found]                     ` <mailman.1142.1373942379.12400.help-gnu-emacs@gnu.org>
2013-07-16  4:13                       ` Rustom Mody
2013-07-16  9:42                         ` Emanuel Berg
2013-07-16 13:37                           ` Rustom Mody
2013-07-16 13:39                           ` Rustom Mody
2013-07-16 20:13                             ` Emanuel Berg
2013-07-16 21:02                             ` Emanuel Berg
2013-07-17  0:54                               ` Juanma Barranquero
     [not found]                               ` <mailman.1203.1374024479.12400.help-gnu-emacs@gnu.org>
2013-07-17  1:41                                 ` Emanuel Berg
2013-07-17  2:05                                   ` Juanma Barranquero
     [not found]                                   ` <mailman.1205.1374026774.12400.help-gnu-emacs@gnu.org>
2013-07-17  2:24                                     ` Emanuel Berg
2013-07-17  2:42                                       ` Juanma Barranquero
     [not found]                                       ` <mailman.1206.1374028983.12400.help-gnu-emacs@gnu.org>
2013-07-17  8:30                                         ` Emanuel Berg
2013-07-17  9:31                                           ` Juanma Barranquero
     [not found]                                           ` <mailman.1232.1374053532.12400.help-gnu-emacs@gnu.org>
2013-07-19 10:18                                             ` Emanuel Berg
2013-07-19 14:51                                               ` Juanma Barranquero
     [not found]                                               ` <mailman.1394.1374245509.12400.help-gnu-emacs@gnu.org>
2013-07-19 16:02                                                 ` Emanuel Berg
2013-07-20  0:03                                                   ` Juanma Barranquero
     [not found]                                                   ` <mailman.1439.1374278629.12400.help-gnu-emacs@gnu.org>
2013-07-20  4:27                                                     ` Emanuel Berg
2013-07-20  4:35                                                       ` Jambunathan K
2013-08-28 23:08                                                     ` Emanuel Berg
2013-07-16 17:54                         ` Eli Zaretskii
2013-07-16 10:07                       ` Emanuel Berg
2013-07-16 17:57                         ` Eli Zaretskii
     [not found]                         ` <mailman.1176.1373997462.12400.help-gnu-emacs@gnu.org>
2013-07-16 19:58                           ` Emanuel Berg
2013-07-16 20:38                             ` Peter Dyballa
     [not found]                             ` <mailman.1187.1374007454.12400.help-gnu-emacs@gnu.org>
2013-07-16 21:11                               ` Emanuel Berg
2013-07-17  8:36                                 ` Thien-Thi Nguyen
2013-07-16 21:25                             ` Dmitry Gutov
2013-07-17  0:57                               ` Juanma Barranquero
     [not found]                             ` <mailman.1191.1374009934.12400.help-gnu-emacs@gnu.org>
2013-07-16 21:37                               ` Dan Espen
2013-07-16 22:05                                 ` Dmitry Gutov
     [not found]                                 ` <mailman.1194.1374012333.12400.help-gnu-emacs@gnu.org>
2013-07-17  1:02                                   ` Dan Espen
2013-07-17  4:29                                     ` Dmitry Gutov
     [not found]                                     ` <mailman.1213.1374035360.12400.help-gnu-emacs@gnu.org>
2013-07-17  6:04                                       ` Emanuel Berg
2013-07-17 12:24                                         ` Eye strain and ergonomics Dmitry Gutov
2013-07-18 20:01                                           ` James Freer
     [not found]                                         ` <mailman.1251.1374063906.12400.help-gnu-emacs@gnu.org>
2013-07-19 10:30                                           ` Emanuel Berg
2013-07-17 12:36                                       ` Speeding up Emacs load time Dan Espen
2013-07-16 21:40                               ` Emanuel Berg
2013-07-16 22:21                                 ` Dmitry Gutov
     [not found]                                 ` <mailman.1196.1374013270.12400.help-gnu-emacs@gnu.org>
2013-07-16 22:55                                   ` Emanuel Berg
2013-07-16 23:48                                     ` Highway Musophobia Revisited [was: Speeding up Emacs load time] Drew Adams
2013-07-17  2:54                                       ` Jambunathan K
2013-07-19 16:21                                       ` Óscar Fuentes
2013-07-19 17:24                                         ` Drew Adams
     [not found]                                         ` <mailman.1428.1374254670.12400.help-gnu-emacs@gnu.org>
2013-07-20  4:20                                           ` Emanuel Berg
     [not found]                                       ` <mailman.1420.1374250899.12400.help-gnu-emacs@gnu.org>
2013-07-20  4:23                                         ` Emanuel Berg
     [not found]                                     ` <mailman.1200.1374018533.12400.help-gnu-emacs@gnu.org>
2013-07-17  0:04                                       ` Highway Musophobia Revisited Emanuel Berg
2013-07-17  3:09                                         ` Drew Adams
     [not found]                                         ` <mailman.1210.1374030559.12400.help-gnu-emacs@gnu.org>
2013-07-17  6:14                                           ` Emanuel Berg
2013-07-17 10:42                                             ` Jambunathan K
2013-07-17 10:42                                             ` Jambunathan K
2013-07-17 16:20                                             ` Drew Adams
2013-07-17 12:27                                       ` Highway Musophobia Revisited [was: Speeding up Emacs load time] Rustom Mody
2013-07-19 10:35                                         ` Emanuel Berg
2013-07-16  5:12                 ` Speeding up Emacs load time Jambunathan K
     [not found]                 ` <mailman.1144.1373951470.12400.help-gnu-emacs@gnu.org>
2013-07-16  9:51                   ` Emanuel Berg
2013-07-16 12:26                     ` Jambunathan K
     [not found]                     ` <mailman.1156.1373977528.12400.help-gnu-emacs@gnu.org>
2013-07-16 20:15                       ` Emanuel Berg
2013-06-28  3:20     ` Bob Proulx
2013-06-28  5:27       ` Hongxu Chen
2013-06-28 19:53         ` Bob Proulx
2013-06-28 12:48       ` J. David Boyd
2013-06-28 14:00         ` J. David Boyd
     [not found]         ` <mailman.2694.1372428065.22516.help-gnu-emacs@gnu.org>
2013-06-28 14:16           ` Dan Espen
2013-06-28 19:06             ` Bob Proulx
     [not found]     ` <mailman.2650.1372389614.22516.help-gnu-emacs@gnu.org>
2013-06-28 20:27       ` Emanuel Berg
2013-06-29  5:04         ` Eric Abrahamsen
     [not found]         ` <mailman.2770.1372482246.22516.help-gnu-emacs@gnu.org>
2013-06-29 17:44           ` Rustom Mody
2013-06-30  0:45             ` Eric Abrahamsen
2013-06-30 12:46             ` Emanuel Berg
2013-06-30 14:04               ` Rustom Mody
2013-06-30 18:06                 ` Emanuel Berg
2013-06-30 15:00               ` Eric Abrahamsen
     [not found]               ` <mailman.2850.1372604415.22516.help-gnu-emacs@gnu.org>
2013-06-30 16:07                 ` Rustom Mody
2013-06-30 18:17                   ` Emanuel Berg
2013-06-30 18:14                 ` Emanuel Berg
2013-07-01  5:29                   ` Eric Abrahamsen
2013-06-29 17:51         ` Bob Proulx
     [not found]         ` <mailman.2800.1372528321.22516.help-gnu-emacs@gnu.org>
2013-06-30 12:36           ` Emanuel Berg
     [not found]   ` <mailman.2429.1372201595.22516.help-gnu-emacs@gnu.org>
2013-06-26  1:16     ` Dan Espen
2013-06-27 16:14     ` Emanuel Berg
2013-06-27 17:50       ` J. David Boyd
2013-07-21  3:59     ` Rustom Mody
2013-07-21 14:18       ` Emanuel Berg
2013-07-21 14:41         ` Rustom Mody

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=861u6mh294.fsf@somewhere.org \
    --to=sva-news-d0wtavr13harg/idocfnwg@public.gmane.org \
    --cc=help-gnu-emacs-mXXj517/zsQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).