From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Sebastien Vauban" Newsgroups: gmane.emacs.help Subject: Re: Speeding up Emacs load time Date: Thu, 25 Jul 2013 21:24:07 +0200 Organization: Sebastien Vauban Message-ID: <861u6mh294.fsf@somewhere.org> References: <86hafjwukz.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1374780316 3845 80.91.229.3 (25 Jul 2013 19:25:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 25 Jul 2013 19:25:16 +0000 (UTC) To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Thu Jul 25 21:25:19 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V2RA6-00067o-8z for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Jul 2013 21:25:18 +0200 Original-Received: from localhost ([::1]:60457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2RA5-0005PT-Kx for geh-help-gnu-emacs@m.gmane.org; Thu, 25 Jul 2013 15:25:17 -0400 X-Received: by 10.180.95.168 with SMTP id dl8mr1515304wib.7.1374780254006; Thu, 25 Jul 2013 12:24:14 -0700 (PDT) Original-Path: usenet.stanford.edu!mf3no17602559wib.1!news-out.google.com!md6ni82518wic.0!nntp.google.com!proxad.net!feeder1-2.proxad.net!137.226.231.214.MISMATCH!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 87 Injection-Info: mx05.eternal-september.org; posting-host="6f05eaee171434c896d44feeaf7179f0"; logging-data="22613"; mail-complaints-to="abuse-VVbKFVtnif8H+i2N2EyTrmui9UKz+5OX@public.gmane.org"; posting-account="U2FsdGVkX19TGUvU+YTe/T8FKTI+Ova2" User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (windows-nt) X-Archive: encrypt Cancel-Lock: sha1:g2xrFGElD8EzpkmSV9wOqHI+K74= sha1:PWQ0SROcBaPagiHpgNUUTap3BI4= X-Url: Under construction... Original-Xref: usenet.stanford.edu gnu.emacs.help:200162 X-BeenThere: help-gnu-emacs-mXXj517/zsQ@public.gmane.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Xref: news.gmane.org gmane.emacs.help:92428 Archived-At: J. David Boyd wrote: > "Sebastien Vauban" 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