[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: looking-at-p slower than looking-at
From: |
Emanuel Berg |
Subject: |
Re: looking-at-p slower than looking-at |
Date: |
Wed, 25 Nov 2015 23:39:00 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Nicolas Richard <nrichard@ulb.ac.be> writes:
> Why is it slower and how much slower is it ? I don't
> see how it can happen from its implementation
Why wouldn't it be slower? It does more things!
Here is a cool macro that confirms (by testing) that
it is indeed slower:
(defmacro measure-time (&rest body)
"Measure and return the running time of the code block.
Not mine: http://nullprogram.com/blog/2009/05/28/"
(declare (indent defun))
(let ((start (make-symbol "start")))
`(let ((,start (float-time)))
,@body
(- (float-time) ,start))))
(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)))
(insert (format " ; %s" (measure-time (looking-at-p "a")))) ;
1.5974044799804688e-05
(insert (format " ; %s" (measure-time (looking-at "a")))) ;
1.2874603271484375e-05
--
underground experts united
http://user.it.uu.se/~embe8573
- How to test if the current line contains only white-spache?, Rolf Ade, 2015/11/15
- 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 <=
- 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, 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