How do I byte-compile everything in my .emacs.d directory?

To automatically byte compile everything that needs byte compiling each time I start emacs, I put the following after my changes to load-path at the top of my .emacs file:

(byte-recompile-directory (expand-file-name "~/.emacs.d") 0)

Surprisingly, it doesn't add much to my startup time (unless something needs to be compiled).

To speed up my emacs, I first identified the slow parts using profile-dotemacs.el and then replaced them with autoloads.


C-u 0 M-x byte-recompile-directory

will compile all the .el files in the directory and in all subdirectories below.

The C-u 0 part is to make it not ask about every .el file that does not have a .elc counterpart.