bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Basil L. Contovounesios
Subject: bug#35675: 27.0.50; Is line-number-at-pos unnecessarily slow?
Date: Sat, 11 May 2019 21:36:59 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

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).

Either way, as Eli says, there's often an algorithmic solution to
slowness in uses of count-lines.

Thanks,

-- 
Basil





reply via email to

[Prev in Thread] Current Thread [Next in Thread]