[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: looking-at-p slower than looking-at
From: |
Barry Margolin |
Subject: |
Re: looking-at-p slower than looking-at |
Date: |
Wed, 25 Nov 2015 10:48:39 -0500 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <mailman.675.1448463102.31583.help-gnu-emacs@gnu.org>,
Nicolas Richard <nrichard@ulb.ac.be> wrote:
> Marcin Borkowski <mbork@mbork.pl> writes:
>
> > You might also (depending on your use-case) want to use looking-at-p,
> > which is marginally slower than looking-at, but does not modify match
> > data.
>
> Why is it slower and how much slower is it ? I don't see how it can
> happen from its implementation:
>
> (defsubst looking-at-p (regexp)
> "\
> Same as `looking-at' except this function does not change the match data."
> (let ((inhibit-changing-match-data t))
> (looking-at regexp)))
>
> thanks,
It takes a tiny amount of time to bind the variable
inhibit-changing-match-data. That's why it's a little slower.
On the other hand, it doesn't have to set the internal variables that
hold the match data, so maybe they cancel out.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
- Re: How to test if the current line contains only white-spache?, (continued)
- Re: How to test if the current line contains only white-spache?, Barry Margolin, 2015/11/15
- Re: How to test if the current line contains only white-spache?, Marcin Borkowski, 2015/11/16
- Re: How to test if the current line contains only white-spache?, Philipp Stephani, 2015/11/16
- looking-at-p slower than looking-at, Nicolas Richard, 2015/11/25
- Re: looking-at-p slower than looking-at, Marcin Borkowski, 2015/11/25
- Re: looking-at-p slower than looking-at, Michael Heerdegen, 2015/11/25
- Re: looking-at-p slower than looking-at, Marcin Borkowski, 2015/11/25
- Re: looking-at-p slower than looking-at, Nicolas Richard, 2015/11/26
- Re: looking-at-p slower than looking-at, Emanuel Berg, 2015/11/25
- Re: looking-at-p slower than looking-at, Nicolas Richard, 2015/11/26
- Message not available
- Re: looking-at-p slower than looking-at,
Barry Margolin <=
- Re: looking-at-p slower than looking-at, Marcin Borkowski, 2015/11/25
Re: How to test if the current line contains only white-spache?, Rolf Ade, 2015/11/16
Message not availableRe: How to test if the current line contains only white-spache?, Rolf Ade, 2015/11/18
Re: How to test if the current line contains only white-spache?, Stefan Monnier, 2015/11/18
Re: How to test if the current line contains only white-spache?, Emanuel Berg, 2015/11/18
Re: How to test if the current line contains only white-spache?, Emanuel Berg, 2015/11/18
Message not availableRe: How to test if the current line contains only white-spache?, Rolf Ade, 2015/11/19
Re: How to test if the current line contains only white-spache?, Marcin Borkowski, 2015/11/19