For a different package that will let you profile your Emacs config without restarting, see The Emacs Startup Profiler (ESUP).

profile-dotemacs Description

Here’s some code to easily profile your Emacs InitFile (or any other script-like Emacs Lisp file, for that matter).

It will go over all sexp’s (balanced expressions) in the file and run them through ‘benchmark-run’. It will then show the file with overlays applied in a way that let you easily find out which sexp’s take the most time. Since time is relative, it’s not the absolute value that counts but the percentage of the total running time.


You can only benchmark full sexp’s, so if you wrapped large parts of your init file in some conditional clause, you’ll have to remove that for getting finer granularity.


Start emacs as follows:

emacs -Q -l PATH/profile-dotemacs.el -f profile-dotemacs

with PATH being the path to where this file resides.

The specific file to be profiled (i.e. ~/.emacs) is hardcoded within profile-dotemacs.el as follows:

(defvar profile-dotemacs-file "~/.emacs" "File to be profiled.")


You can always get the latest version from