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: Lars Ingebrigtsen
Subject: bug#22763: 25.1.50; Feature Request -- A faster method to obtain line number at position.
Date: Sun, 07 Feb 2021 20:34:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

> I'll try to whip up a benchmark with really long lines and see what
> happens.

(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?)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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