[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#35675: 27.0.50; Is line-number-at-pos unnecessarily slow?
From: |
Alex Branham |
Subject: |
bug#35675: 27.0.50; Is line-number-at-pos unnecessarily slow? |
Date: |
Tue, 14 May 2019 07:34:24 -0500 |
User-agent: |
mu4e 1.2.0; emacs 27.0.50 |
On Sat 11 May 2019 at 15:36, Basil L. Contovounesios <contovob@tcd.ie> wrote:
> Alex Branham <alex.branham@gmail.com> writes:
>
>> line-number-at-pos basically regex searches forward for \n's and
>> counts them up.
>
> It only does this (via count-lines) if selective-display is t, which is
> deprecated and seldom used. Otherwise it uses the value returned by
> forward-line (defined in C), which calls find_newline, which AFAIK uses
> the buffer's newline cache to some extent (I'm not familiar with its
> implementation).
Thanks, I missed/misunderstood that part.
> Either way, as Eli says, there's often an algorithmic solution to
> slowness in uses of count-lines.
I'll take that advice and see if there's a more clever way to go about it.
Thanks again,
Alex