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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22763: 25.1.50; Feature Request -- A faster method to obtain line nu


From: Eli Zaretskii
Subject: bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position.
Date: Sun, 07 Feb 2021 21:43:59 +0200

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: 22763@debbugs.gnu.org,  esq@lawlist.com,  monnier@iro.umontreal.ca
> Date: Sun, 07 Feb 2021 20:34:56 +0100
> 
> (with-temp-buffer
>   (dotimes (_ 10000)
>     (insert (make-string (random 4000) ?a) "\n"))
>   (benchmark-run 10
>     (goto-char (point-min))
>     (while (not (eobp))
>       (line-number-at-pos (point))
>       (forward-line 1))))
> 
> With this, the new version still wins...  but only slightly.  So the
> cache does indeed help when we've got long lines (which was the point of
> the cache, I guess?)

Yes.





reply via email to

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