From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.devel Subject: Re: Inefficient code in reftex-index.el Date: Wed, 08 Jun 2005 11:47:47 +0200 Message-ID: <85vf4p9o3g.fsf@lola.goethe.zz> References: <85slzv7j87.fsf@lola.goethe.zz> <858y1n2g75.fsf@lola.goethe.zz> <85oeai1pwq.fsf@lola.goethe.zz> <878y1mkpy3.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1118224269 18603 80.91.229.2 (8 Jun 2005 09:51:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 8 Jun 2005 09:51:09 +0000 (UTC) Cc: emacs-devel@gnu.org, rms@gnu.org, "Kim F. Storm" , dominik@science.uva.nl Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 08 11:51:00 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DfxBj-0007Cg-Pe for ged-emacs-devel@m.gmane.org; Wed, 08 Jun 2005 11:49:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DfxIQ-0003TK-D5 for ged-emacs-devel@m.gmane.org; Wed, 08 Jun 2005 05:56:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DfxHP-00034H-Kp for emacs-devel@gnu.org; Wed, 08 Jun 2005 05:55:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DfxHO-00033c-FY for emacs-devel@gnu.org; Wed, 08 Jun 2005 05:55:22 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DfxHO-00032l-98 for emacs-devel@gnu.org; Wed, 08 Jun 2005 05:55:22 -0400 Original-Received: from [199.232.76.164] (helo=fencepost.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DfxDj-0001YZ-38 for emacs-devel@gnu.org; Wed, 08 Jun 2005 05:51:35 -0400 Original-Received: from localhost ([127.0.0.1] helo=lola.goethe.zz) by fencepost.gnu.org with esmtp (Exim 4.34) id 1Dfx8Q-0002Iu-BH; Wed, 08 Jun 2005 05:46:06 -0400 Original-Received: by lola.goethe.zz (Postfix, from userid 1002) id 337231C3DFFF; Wed, 8 Jun 2005 11:47:47 +0200 (CEST) Original-To: Stefan Monnier In-Reply-To: <878y1mkpy3.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 07 Jun 2005 14:06:21 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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:38307 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:38307 Stefan Monnier writes: >>> There is no other interface into the number of accessible match >>> strings (which might be nil) rather than >>> (/ (length (match-data t)) 2). > >> That's still pretty inefficient -- I suggest that we introduce a new >> function `match-count' to return that number. > >> Is there sufficient use for this function to justify introducing it? >> I think that most cases where this would be used, the code would >> then proceed to call match-data. > > Actually the only cases I can vaguely remember using the > (/ (length (match-data)) 2) idiom didn't use the whole (match-data). > They typically used the idiom in order to know *which* subgroup matched (of > course it only works if you craft your regexp carefully). That would not work. (length (match-data)) is a property of the regexp, not the match. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum