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

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

Re: Fast emacs?


From: Anselm Helbig
Subject: Re: Fast emacs?
Date: Sun, 17 May 2009 23:39:30 +0200
User-agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shij┼Ź) APEL/10.7 Emacs/22.3 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI)

Hi!

> For ***years*** I've been looking for a solution to this problem,
> and I'm truly amazed that I have yet to find it: how to get a
> fast-starting version of emacs.  The problem is that I have a big
> .emacs file and a big Emacs desktop, which means that my Emacs takes
> forever to start.  This is fine most of the time, but occasionally
> I want a fast-starting emacs session (e.g. when I run "sudo emacs"
> to edit a superuser-owned config file), and it's infuriating to
> wait for emacs to go through a lengthy and useless song-and-dance...
> 
> I just can't believe there is no way around this.  (Other than, of
> course, using vi.)
> 
> Note that using the emacsclient is no solution, because this requires
> that a version of Emacs be already running, which often defeats
> the purpose (not only do I have to wait another eternity for this
> new Emacs session to start, but then I have to start the server in
> the new session).
> 
> Any words of wisdom would be much appreciated!

Emacs has tons of functionality baked in right from the start, yet its
startup time is reasonably fast if you don't have customizations. So,
learning from core emacs means learning how to start up fast. There
are lots of possible improvements you can make:

- don't use `require', use autoloads:
  http://www.emacswiki.org/emacs/AutoLoad
  Magic comments can help, see (info "(elisp) Autoload")
  Use `update-autoloads-from-directories' to automatically generate
  the autoloads for you.

- for stuff that can only be configured once a library is loaded, use
  `eval-after-load'. 

- make a new emacs image with all your favourite libraries already
  loaded: http://www.emacswiki.org/emacs/DumpingEmacs

- start emacs as part of system startup with the --daemon switch:
  http://www.emacswiki.org/emacs/EmacsAsDaemon

- byte-compile the libraries you use; consider byte-compiling your
  .emacs if it is huge

- remove extensions you don't use

- measure the progress you make: use the lisp function benchmark-run,
  or `time' on the command line. Try adding (kill-emacs) at the end
  of your .emacs file to get meaningful results for this.

My init file has 1677 lines, emacs starts in 2.3 seconds (hot
cache). Hmmm... this could be improved. 8-)

Happy tuning!

Anselm


-- 
Anselm Helbig 
mailto:address@hidden


reply via email to

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