tags:

views:

101

answers:

3

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?
+4  A: 

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
Ditto what he said. Also, if you're using a package that came with emacs, then it is probably already byte-compiled.
pheaver
The question is about packages not individual files, so IMHO M-x byte-recompile-directory might be a better fit.
Laurynas Biveinis
+3  A: 

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
+3  A: 

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