From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Porter Subject: Re: working with tables can be quite painful... Date: Sat, 17 Sep 2016 10:22:06 -0500 Message-ID: <87y42qo8kh.fsf@alphapapa.net> References: <87r38jew14.fsf@ucl.ac.uk> <87fuoyrjxe.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blHRy-0008PV-6j for emacs-orgmode@gnu.org; Sat, 17 Sep 2016 11:22:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1blHRs-0001u2-6d for emacs-orgmode@gnu.org; Sat, 17 Sep 2016 11:22:41 -0400 Received: from [195.159.176.226] (port=34342 helo=blaine.gmane.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1blHRs-0001sw-0i for emacs-orgmode@gnu.org; Sat, 17 Sep 2016 11:22:36 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1blHRb-0002R8-8m for emacs-orgmode@gnu.org; Sat, 17 Sep 2016 17:22:19 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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