In case this helps anyone, I've found this code makes profiling a lot
easier.  It automatically instruments the desired functions, runs the
code you want to test, removes the instrumentation, and presents the
results.

#+BEGIN_SRC elisp
  (defmacro profile-org (times &rest body)
    `(let (output)
       (dolist (p '("org-"))  ; symbol prefixes to instrument
         (elp-instrument-package p))
       (dotimes (x ,times)
         ,@body)
       (elp-results)
       (elp-restore-all)
       (point-min)
       (forward-line 20)
       (delete-region (point) (point-max))
       (setq output (buffer-substring-no-properties (point-min) (point-max)))
       (kill-buffer)
       (delete-window)
       output))

  ;; Used like this:
  (profile-org 10
    (org-table-next-field)
    (org-table-align))
#+END_SRC


Reply via email to