[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: looking-at-p slower than looking-at
From: |
Marcin Borkowski |
Subject: |
Re: looking-at-p slower than looking-at |
Date: |
Wed, 25 Nov 2015 21:39:04 +0100 |
User-agent: |
mu4e 0.9.13; emacs 25.0.50.1 |
On 2015-11-25, at 16:48, Barry Margolin <barmar@alum.mit.edu> wrote:
> 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.
Ah, I didn't think of that. Stupid me. (That might be the answer to
the question why my benchmarks were inconclusive.)
Thanks,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
- 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?, 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, 2015/11/25
- Re: looking-at-p slower than looking-at,
Marcin Borkowski <=
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
Re: How to test if the current line contains only white-spache?, Emanuel Berg, 2015/11/19