4

With packages loading such as orgmode, nxhtml, yasnippet, I see that the loading of emacs slowed down pretty much.

I expect I can speed it up with the compilation of the packages.

  • I can I do that with emacs?
  • Normally, how much speed up can I expect?
prosseek
  • 182,215
  • 215
  • 566
  • 871
  • 1
    possible duplicate of [How can I make Emacs start-up faster?](http://stackoverflow.com/questions/778716/how-can-i-make-emacs-start-up-faster) – Trey Jackson Sep 29 '10 at 04:51
  • 1
    I'd suggest to first profile your emacs startup file; see http://www.emacswiki.org/emacs/ProfileDotEmacs for details. Then take a look at those packages which take the most time; if those are already compiled, make use of autoloads, eval-after-load, etc. – pokita Sep 29 '10 at 08:06

3 Answers3

7

Yes, you can do it: M-x byte-compile-file on each .el that you want to compile. It won't speed things up as much, though, as will using "autoload" and "eval-when-require".

offby1
  • 6,767
  • 30
  • 45
5

Generally everything that comes with the Emacs installation is byte compiled and every package you installed via a Linux distribution package management system is compiled as well. If you're using ELPA - it byte compiles the packages after downloading them. That said, byte-compilation will not bring you any significant performance gains.

If we assume that the greatest bottleneck with Emacs performance is its startup time, you'd do a lot better to start a single Emacs instance as a daemon(emacs --daemon) and share it between multiple emacsclient processes that will start instantly once the daemon is running.

Bozhidar Batsov
  • 55,802
  • 13
  • 100
  • 117
5

The easiest way to get a speedup in your .emacs file doesn't have much to do with byte compilation, though you should always byte compile new packages you install.

Instead, if you know you do this in your .emacs:

(require 'some-pkg)

and then later you might do this:

`M-x command-in-pkg'

you are better off adding this to your .emacs file.

(autoload 'command-in-pkg "some-pkg" "A command in some package" t)

which will load much faster at startup than the original require. Many packages have installation setups that have a file full of autoloads that you require in your .emacs file which will already be optimized as best that maintainer can get it.

Eric
  • 3,959
  • 17
  • 15