This is 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.
‘profile-dotemacs-low-percentage’will be preceded by a highlighted line, showing the results from
‘benchmark-run’. Also, the more ‘reddish’ the background of the sexp, the more time it needs.
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.
You can always get the latest version from http://randomsample.de/profile-dotemacs.el