From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Compiling Elisp to a native code with a GCC plugin Date: Wed, 15 Sep 2010 17:42:26 +0200 Message-ID: References: <87bp805ecr.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1284565385 10846 80.91.229.12 (15 Sep 2010 15:43:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 15 Sep 2010 15:43:05 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 15 17:43:04 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 1Ovu8R-0003gg-04 for ged-emacs-devel@m.gmane.org; Wed, 15 Sep 2010 17:42:59 +0200 Original-Received: from localhost ([127.0.0.1]:35036 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ovu8Q-0007AC-DA for ged-emacs-devel@m.gmane.org; Wed, 15 Sep 2010 11:42:58 -0400 Original-Received: from [140.186.70.92] (port=57884 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ovu8E-00079Y-Ly for emacs-devel@gnu.org; Wed, 15 Sep 2010 11:42:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ovu88-0000Rr-0o for emacs-devel@gnu.org; Wed, 15 Sep 2010 11:42:46 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:35745) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ovu87-0000Rl-UN for emacs-devel@gnu.org; Wed, 15 Sep 2010 11:42:39 -0400 Original-Received: from ceviche.home (vpn-132-204-232-22.acd.umontreal.ca [132.204.232.22]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id o8FFgWxe031513; Wed, 15 Sep 2010 11:42:33 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 930B466289; Wed, 15 Sep 2010 17:42:26 +0200 (CEST) In-Reply-To: (Lars Magne Ingebrigtsen's message of "Wed, 15 Sep 2010 17:09:16 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3622=0 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:130215 Archived-At: > So you end up with > (or (looking-at "foo ") (search-forward "\nfoo ")) > which creates a regexp, anyway, and seems clumsy. Unless the text you match is short, the above is probably the fastest, indeed. There is no built-in support for the above idiom, OTOH, so you have to pay for the extra Elisp interpretation overhead of calling looking-at and then search-forward. > So what I wonder is whether there is a smarter way to do this, in > general. (I'm assuming that a simple string search is faster than a > regexp search, but I've never actually benchmarked this.) A simple string search is indeed faster and uses one of those algorithms that are faster for longer search strings. Stefan