From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lars Magne Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Compiling Elisp to a native code with a GCC plugin Date: Thu, 16 Sep 2010 18:57:22 +0200 Organization: Programmerer Ingebrigtsen Message-ID: References: <87bp805ecr.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1284661081 3307 80.91.229.12 (16 Sep 2010 18:18:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 16 Sep 2010 18:18:01 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Sep 16 20:17:59 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OwJ1z-00063P-2E for ged-emacs-devel@m.gmane.org; Thu, 16 Sep 2010 20:17:59 +0200 Original-Received: from localhost ([127.0.0.1]:44238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwJ1y-0005WB-Ac for ged-emacs-devel@m.gmane.org; Thu, 16 Sep 2010 14:17:58 -0400 Original-Received: from [140.186.70.92] (port=35657 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwIEe-0001B1-E5 for emacs-devel@gnu.org; Thu, 16 Sep 2010 13:27:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwHmI-0007jp-Iu for emacs-devel@gnu.org; Thu, 16 Sep 2010 12:57:47 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:46543) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OwHmI-0007jZ-8m for emacs-devel@gnu.org; Thu, 16 Sep 2010 12:57:42 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OwHmF-0000Nb-Lx for emacs-devel@gnu.org; Thu, 16 Sep 2010 18:57:39 +0200 Original-Received: from cm-84.215.34.171.getinternet.no ([84.215.34.171]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Sep 2010 18:57:39 +0200 Original-Received: from larsi by cm-84.215.34.171.getinternet.no with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Sep 2010 18:57:39 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 104 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cm-84.215.34.171.getinternet.no Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEUuIhtpTCzbwZUGAwYV Dg5ENSMbGGRVAAACRElEQVQ4jU2UwY7jIAyGnS3c43S4b9DmXgkegFHcO8zU7/8q+9ukO4uqCvFh /7axQ0IUtz2U2lSjKmEFwaJAceRjAhBaO5GSBANbTrdSKUZDvKSe8CMhBThLAWBNnZn7ij9qNHI+ ABoBqPaoIRI0GnHOazEweIW3ZQzGDWqQyB8GInOaQJM2Mk/5G6Au8AzQ1QOm+JXzfhqIe84m0qmH 4DG5NgB2SWeOTdzT72Krma2ZePYOXhPY9gIhEOzzrTpYsvtKbkDZJOo/kUOnTTOwniKlSPUATV4v 8KotnFVO17tAANhDi2qgRfM7PJUXwIEqaZAWHpbT7haxA6xP2+PRXMR8eSaQeOoYA+UpVujMVyqQ iDpYe7hV0vyTPCQc0PMuQ6+AoU55bYOpiyx3ehlwXwh4f8XRCV0yhGqPE5hFQtsEOoswxdatKvuM 6+MR8Y4iLfF4Bpq+rI7fQt0q8skb06wKu8XZAGgtC+c1zKrsDqyf2pLC2HZm9MCsSnSgoeN+Zs4s LuLvjkuMB+YNPYIGc1/JQKNlPx9kz2pg+rKStLjwWdsF/lTvFbQWUFyRxRsUsZ33FrL4AR+Yk0sk JjGwvUGRL+sVswhShf8DvywTogcJ5g+N7uCO/nqaL6LafDbasr1BnaB4E0qR8QYFvg6AMkGxlDMi l/LwF3QgMHtayoz589UvC/w+t8zpOt7yOgFqgtEHuY4xSxMUaSPZyW5xW+THBWpUv7tfvhifDFun xDQ6xt+71h6pEA4NSMDIx+5fJDsofwHl8bmKnaLXJwAAAABJRU5ErkJggg== Mail-Copies-To: never X-Now-Playing: Kate Bush's _Lionheart_: "Fullhouse" User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:LM19x/TMvdLRaERx0RMMff30tLg= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:130260 Archived-At: --=-=-= Content-Type: text/plain Andreas Schwab writes: >> I did some trivial benchmarking with >> >> (while (search-backward "\n(defun " nil t))) >> >> and the equivalent re-search-backward in a buffer in a loop, and the >> search-backward version was about 8x faster. > > How did you measure that? When I tried I did not see any significant > difference. I just call the stuff I want to benchmark a gazillion times with my tiny benchmark.el package: (benchmark 10000 (goto-char (point-min)) (while (search-forward "\n(defun " nil t) (forward-line 1))) --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=benchmark.el Content-Transfer-Encoding: quoted-printable ;;; benchmark.el --- functions for benchmarking Emacs Lisp code ;; Copyright (C) 1998 Lars Magne Ingebrigtsen ;; Author: Lars Magne Ingebrigtsen ;; Keywords: utilities ;; This file is not part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;; To benchmark code, simply say ;; ;; (benchmark 4 ;; (sit-for 1)) ;; ;; In this example, the `sit-for' function will be run four times. ;;; Code: (defun benchmark-make-time-float (list) (+ (* 65536.0 (pop list)) (pop list) (/ (or (pop list) 0) 1e6))) (put 'benchmark 'lisp-indent-function 1) (put 'benchmark 'edebug-form-spec '(form body)) ;;;###autoload (defmacro benchmark (n &rest forms) "Execute FORMS N times and return the elapsed time. FORMS will be byte-compiled before they are executed." `(benchmark-1 ,n ',forms)) (defun benchmark-1 (n forms) (let ((bi (make-symbol "benchmark-i"))) (let ((func (byte-compile `(lambda () (let ((,bi ,n)) (while (not (zerop ,bi)) (setq ,bi (1- ,bi)) ,@forms))))) t1 t2 result) (setq t1 (current-time)) (funcall func) (setq t2 (current-time) result (- (benchmark-make-time-float t2) (benchmark-make-time-float t1))) (message "Time elapsed: %.4f" result) result))) (provide 'benchmark) ;;; benchmark.el ends here --=-=-= Content-Type: text/plain -- (domestic pets only, the antidote for overdose, milk.) larsi@gnus.org * Lars Magne Ingebrigtsen --=-=-=--