emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] working with tables can be quite painful...


From: Adam Porter
Subject: Re: [O] working with tables can be quite painful...
Date: Sat, 17 Sep 2016 10:22:06 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

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

[Prev in Thread] Current Thread [Next in Thread]