[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual
From: |
Noam Postavsky |
Subject: |
Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual |
Date: |
Wed, 6 Jun 2018 09:13:20 -0400 |
On 6 June 2018 at 03:43, Robert Pluim <address@hidden> wrote:
>> And I think you'll want to give a limit
>> to the looking-back calls, otherwise they can keep searching until the
>> beginning of buffer.
>
> ((looking-back "(") should never look at more than one character.
Perhaps it shouldn't, but Emacs doesn't make that kind of optimization:
(with-temp-buffer
(let ((last-command-event ?a))
(dotimes (i 8)
(self-insert-command (expt 10 i))
(benchmark 1 '(looking-back "(")))))
Elapsed time: 0.000036s
Elapsed time: 0.000030s
Elapsed time: 0.000066s
Elapsed time: 0.000427s
Elapsed time: 0.004068s
Elapsed time: 0.040317s
Elapsed time: 0.422173s
Elapsed time: 1.514244s
(with-temp-buffer
(let ((last-command-event ?a))
(dotimes (i 8)
(self-insert-command (expt 10 i))
(benchmark 1 '(looking-back "(" (1- (point)))))))
Elapsed time: 0.000031s
Elapsed time: 0.000027s [5 times]
Elapsed time: 0.000041s
Elapsed time: 0.000045s
> I could always do (eq (char-before) ?() I suppose.
That's probably better. But wait! This time you *should* have a backslash: ?\(
> The regexp produced by (sentence-end) looks like itʼs fairly well
> anchored. Besides, Iʼm not searching for an end-of-sentence, Iʼm
> asking "Am I at end-of-sentence".
Which is exactly why you should put a limit.
- Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual, (continued)
- Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual, Robert Pluim, 2018/06/04
- Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual, Eli Zaretskii, 2018/06/04
- Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual, Robert Pluim, 2018/06/04
- Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual, Eli Zaretskii, 2018/06/05
- Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual, Robert Pluim, 2018/06/05
- Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual, Noam Postavsky, 2018/06/05
- Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual, Robert Pluim, 2018/06/06
- Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual,
Noam Postavsky <=
- Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual, Robert Pluim, 2018/06/06
- Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual, Noam Postavsky, 2018/06/06
- Re: bug#31636: 27.0.50; lockfile syntax searchable from info manual, Robert Pluim, 2018/06/06