[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: `looking-back' strange warning
From: |
Drew Adams |
Subject: |
RE: `looking-back' strange warning |
Date: |
Thu, 1 Oct 2015 22:13:01 -0700 (PDT) |
> > You can pass (point-min) for the limit if that's what you want.
> > Making it optional Encourages people to think that looking-at is just
> > like looking-back, with the same performance characteristic, whereas
> > making it mandatory encourages people to put a reasonable limit and
> > hence avoid pathological behavior at the end of large buffers.
>
> My two cents: Even if you specify an optimal limit, `looking-back' can
> still be unnecessarily slow. For example,
> (looking-back "xy" 2)
> is much slower than
> (and (> (point) 2)
> (save-excursion (goto-char (- (point) 2))
> (looking-at "xy")))
> where "xy" stands for any plain string.
Definitely. And this is in fact a typical case of the
misuse: the string to check is often a literal, so its
length is known.
This is the first thing to mention about `looking-back',
in terms of performance: avoid it altogether, if you can.
- RE: `looking-back' strange warning, (continued)
RE: `looking-back' strange warning, Drew Adams, 2015/10/08
- Re: `looking-back' strange warning, Dmitry Gutov, 2015/10/08
- Re: `looking-back' strange warning, Andreas Röhler, 2015/10/08
- Re: `looking-back' strange warning, Dmitry Gutov, 2015/10/08
- Re: `looking-back' strange warning, Andreas Röhler, 2015/10/08
- Re: `looking-back' strange warning, Stefan Monnier, 2015/10/08
- Re: `looking-back' strange warning, Michael Heerdegen, 2015/10/08
- Re: `looking-back' strange warning, Michael Heerdegen, 2015/10/08
- RE: `looking-back' strange warning,
Drew Adams <=
- RE: `looking-back' strange warning, Drew Adams, 2015/10/08
- Re: `looking-back' strange warning, Tassilo Horn, 2015/10/08
- RE: `looking-back' strange warning, Drew Adams, 2015/10/08
- Re: `looking-back' strange warning, Tassilo Horn, 2015/10/08
- RE: `looking-back' strange warning, Drew Adams, 2015/10/08
- Re: `looking-back' strange warning, Andreas Röhler, 2015/10/08
- RE: `looking-back' strange warning, Drew Adams, 2015/10/08
RE: `looking-back' strange warning, Drew Adams, 2015/10/08
Re: `looking-back' strange warning, Andreas Röhler, 2015/10/08
Re: `looking-back' strange warning, Michael Heerdegen, 2015/10/08