unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
Cc: emacs-devel@gnu.org, monnier@iro.umontreal.ca, storm@cua.dk,
	dominik@science.uva.nl
Subject: Re: Inefficient code in reftex-index.el
Date: Fri, 10 Jun 2005 16:13:05 +0200	[thread overview]
Message-ID: <85u0k6s3ke.fsf@lola.goethe.zz> (raw)
In-Reply-To: <E1Dgjac-0000FT-QR@fencepost.gnu.org> (Richard Stallman's message of "Fri, 10 Jun 2005 09:30:26 -0400")

Richard Stallman <rms@gnu.org> writes:

>     Certainly cleaner than the straw man you are trying to put up, no
>     question about that.
>
> It's not a straw man.  It's what I'd expect most such cases to do.
>
> If it is very important to optimize your code, we could add a
> function match-count to do so.  But is it really that important to
> optimize?

I think that if one has the situation of a number of strings and
corresponding actions in a data structure, and one wants to repeatedly
search for the next occurence of any matching string, and then do the
recorded corresponding action, this would be a typical situation where
match-count would be convenient.

grepping through the Emacs tree suggests that this usage is not
common, however.  But I did see several occasions where match-count
seemed appropriate as a loop limit for running through possible
matched groups after a match.

There is also the following in tramp.el:
/home/tmp/emacs/lisp/net/tramp.el:6450:  (let* ((nmatches (/ (length (match-data)) 2))
/home/tmp/emacs/lisp/net/tramp.el:6793:    (setq len (/ (length (match-data t)) 2))

In particular the former usage suffers from the "trailing markers"
slowdown.  While it is something that should be fixed here, it would
seem that the availability of match-count would have prevented this
particular abuse.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  reply	other threads:[~2005-06-10 14:13 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-06 12:08 Inefficient code in reftex-index.el Kim F. Storm
2005-06-06 12:39 ` David Kastrup
2005-06-06 13:52   ` Stefan Monnier
2005-06-06 14:14     ` Kim F. Storm
2005-06-06 14:15     ` Juanma Barranquero
2005-06-06 14:18   ` Kim F. Storm
2005-06-06 22:24     ` Kim F. Storm
2005-06-06 23:55       ` David Kastrup
2005-06-07  8:46         ` Kim F. Storm
2005-06-07  9:23           ` David Kastrup
2005-06-07 10:38             ` Kim F. Storm
2005-06-07 11:05               ` David Kastrup
2005-06-07 11:28                 ` Kim F. Storm
2005-06-07 14:28               ` Richard Stallman
2005-06-07 14:46                 ` Kim F. Storm
2005-06-07 18:06                 ` Stefan Monnier
2005-06-08  8:44                   ` Kim F. Storm
2005-06-08  9:47                   ` David Kastrup
2005-06-08 10:00                     ` Kim F. Storm
2005-06-08 10:11                       ` David Kastrup
2005-06-08 15:59                   ` Richard Stallman
2005-06-08 16:25                     ` David Kastrup
2005-06-09 14:40                       ` Richard Stallman
2005-06-09 15:05                         ` David Kastrup
2005-06-10 13:30                           ` Richard Stallman
2005-06-10 14:13                             ` David Kastrup [this message]
2005-06-07 14:28           ` Richard Stallman
2005-06-07 14:35             ` David Kastrup
2005-06-08 15:59               ` Richard Stallman
2005-06-07 14:42             ` Kim F. Storm
2005-06-07 18:11           ` Stefan Monnier
2005-06-08 12:01       ` Richard Stallman
2005-06-08 23:08         ` Kim F. Storm
2005-06-07 12:24     ` Richard Stallman
2005-06-06 14:41   ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=85u0k6s3ke.fsf@lola.goethe.zz \
    --to=dak@gnu.org \
    --cc=dominik@science.uva.nl \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=storm@cua.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).