It turns out that just one line in that example is responsible for causing that lag: (* ''a is a special equality type (it is not the same as the generic 'a type. It *) I have updated the MWE. After evaluating the macro definition I posted earlier and the new example below, hit "C-c r". Installing a package from Elpa is also good for sanity. That way I do not worry about local changes made in your or my Elpa git clones. Installing from Elpa ensures that you and I are using the exact same version of the package (assuming that the package did not update in the meanwhile :)). ===== (emacs-pkg-debug-setup '(;; Install sml-mode from GNU Elpa (nil . (sml-mode))) (let ((test-file (expand-file-name "lag_test.sml" user-emacs-directory))) ; the macro sets user-emacs-directory to (concat temporary-file-directory (getenv "USER") "/" ".emacs.d-debug/") (defun my-report () (interactive) (profiler-report) (profiler-stop) (profiler-reset)) (global-set-key (kbd "C-c r") #'my-report) (with-temp-buffer (insert "(* ''a is a special equality type (it is not the same as the generic 'a type. It *)") (write-file test-file)) (profiler-start 'cpu) (find-file test-file))) ===== -- Kaushal Modi