help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interesting problem: eval-after-load and local variables


From: Bob Proulx
Subject: Re: Interesting problem: eval-after-load and local variables
Date: Thu, 18 Oct 2012 11:46:49 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

Kevin Rodgers wrote:
> Sebastien Vauban wrote:
> > I know. And this is a very somewhat ridiculous example. But, for
> > speed and clarity of my .emacs, I've generally put all customs
> > inside an eval-after-load. A setq is certainly not time-taker,
> > certainly not when alone, but I've applied the same principal to
> > many other blocks of customs.
> 
> I don't see how the eval-after-load boilerplate provides any speed
> or clarity.

I don't know about clarity, although it is nice to know where things
are used, but it can save a very large amount of time when you are
loading up a lot of various bits of emacs functionality.  Things start
up fairly quickly when doing nothing.

  $ time emacs -Q -f kill-emacs
  real    0m0.820s
  user    0m0.088s
  sys     0m0.040s

But on a system where I have many things being loaded with require
this and require that and all of those are required to be loaded
before I have a working emacs and can see and type in anything:

  $ time emacs -f kill-emacs
  real    0m8.362s
  user    0m0.580s
  sys     0m0.168s

That is a *HUGE* difference.  By making use of eval-after-load I have
reduced that startup time to this.  It isn't on the same system and
not directly comparable to the above so I will show both times for
comparison.  And it is on these slower systems where the full load
times were very long and motivated me to optimize the startup.

  $ time emacs -Q -f kill-emacs
  real    0m1.940s
  user    0m0.156s
  sys     0m0.060s

  $ time emacs -f kill-emacs
  real    0m2.423s
  user    0m0.260s
  sys     0m0.132s

And I still have a ways to go.  (Just noting that in the above I
dropped caches between runs making those cold disk accesses for all.)
It was more than 2x slower and the original startup time of the fully
loaded emacs with lots of requires was around 18 seconds.  Getting
that down to less than 2.5 seconds was a huge win.  Now I need to go
back and hit my original machine and get that 8 second load time now.

Using eval-after-load and lazy-loading libraries on demand as they are
needed can be a huge startup speed improvement over simply requiring
libraries and loading every possible thing at every startup.  You
probably aren't going to ise it.  And if you do then you can load it
then.

Bob



reply via email to

[Prev in Thread] Current Thread [Next in Thread]