all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: Glenn Morris <rgm@gnu.org>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: string-match-p [was Re: [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620.]
Date: Mon, 24 Jun 2013 18:16:25 +0200	[thread overview]
Message-ID: <CAAeL0SStOJKe06_e8Jgb9td74_XT9Ai+a-MLQ=_m0QuQwQLfGw@mail.gmail.com> (raw)
In-Reply-To: <ofk3ljij2e.fsf_-_@fencepost.gnu.org>

On Mon, Jun 24, 2013 at 6:12 PM, Glenn Morris <rgm@gnu.org> wrote:

> If I don't care about the match data one way or the other (as here, I
> assume) why is string-match-p preferable? Is it faster or something?

If we consider (as we do) that save-match-data is expensive enough
that we only do when necessary, I'd assume not registering the match
data is faster than registering it, yes.

But anyway, the main reason is legibility. If you encounter
string-match-p or looking-at-p you can be confident that they are
being used as predicates and the following code does not depend on the
match data. That is a net gain IMO.

   J



  reply	other threads:[~2013-06-24 16:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E1UqwLj-0000Jr-EW@vcs.savannah.gnu.org>
2013-06-24  3:19 ` [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620 Stefan Monnier
2013-06-24  4:17   ` Leo Liu
2013-06-24 12:02     ` Juanma Barranquero
2013-06-24 16:12       ` string-match-p [was Re: [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620.] Glenn Morris
2013-06-24 16:16         ` Juanma Barranquero [this message]
2013-06-25  1:30           ` Leo Liu
2013-06-24 16:09     ` [Emacs-diffs] trunk r113149: * ido.el (ido-read-internal): Fix bug#14620 Eli Zaretskii

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

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

  git send-email \
    --in-reply-to='CAAeL0SStOJKe06_e8Jgb9td74_XT9Ai+a-MLQ=_m0QuQwQLfGw@mail.gmail.com' \
    --to=lekktu@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=rgm@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.