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 16:59:31 +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 1284562803 29601 80.91.229.12 (15 Sep 2010 15:00:03 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 15 Sep 2010 15:00:03 +0000 (UTC) Cc: emacs-devel@gnu.org To: Helmut Eller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 15 17:00:01 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 1OvtSm-0001K6-Lk for ged-emacs-devel@m.gmane.org; Wed, 15 Sep 2010 16:59:56 +0200 Original-Received: from localhost ([127.0.0.1]:33014 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OvtSm-0001ke-1W for ged-emacs-devel@m.gmane.org; Wed, 15 Sep 2010 10:59:56 -0400 Original-Received: from [140.186.70.92] (port=52247 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OvtSb-0001gV-UX for emacs-devel@gnu.org; Wed, 15 Sep 2010 10:59:50 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OvtSW-0001MW-Mq for emacs-devel@gnu.org; Wed, 15 Sep 2010 10:59:45 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:50374) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OvtSW-0001MD-Io for emacs-devel@gnu.org; Wed, 15 Sep 2010 10:59:40 -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 o8FExZDg028416; Wed, 15 Sep 2010 10:59:35 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 0BD3A66289; Wed, 15 Sep 2010 16:59:31 +0200 (CEST) In-Reply-To: (Helmut Eller's message of "Wed, 15 Sep 2010 16:27:38 +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:130210 Archived-At: >> - The main problem with Emacs regexps right now is that they have >> pathological cases where the match-time is enormous (potentially >> exponential explosion in the size of the input string). To be >> worthwhile a replacement should address this problem, which basically >> needs it should not be based on backtracking. > Is it possible (theoretically) to implement all of Emacs regexps without > backtracking? In particular those with back-references (\N) seem > problematic. Or is it necessary to recognize "optimizable" regexps > before using a different regexp engine? IIRC regexps without back-refs can be matched (and searched) in O(N) where N is the length of the input. With back-refs, I think (not sure) the theoretical bound is O(N^2), which requires a non-backtracking algorithm. So yes, we'd need to handle back-refs specially. Several regexp engines do that already (they have a few different inner engines and choose which one to use based on the particular regexp at hand). Stefan