Subject: Re: bug#76504: 31.0.50; Excessive redisplay when display-line-numbers-mode is enabled

From: Eli Zaretskii <[email-masked]>
Date: Sun, 23 Feb 2025 18:48:54 +0200

> Cc: [email-masked]
> Date: Sun, 23 Feb 2025 18:10:35 +0200
> From: Eli Zaretskii <[email-masked]>
> 
> Anyway, why is the number of calls to redisplay_internal an issue?
> Emacs calls redisplay_internal when it's idle, so the number of calls
> does not necessarily say anything of importance.

Scratch that: the larger number of samples inside redisplay_internal
is explained by the fact that each of the calls is more expensive when
line numbers are turned on.  Although the large factor you see sounds
too much to me, but I never looked at that metrics.

Anyway, what's important is the time it takes to scroll through a file
with and without line numbers.  So please try the command below and
post the times it reports after scrolling through some large file with
and without the line numbers:

(defun scroll-up-benchmark ()
  (interactive)
  (let ((oldgc gcs-done)
        (oldtime (float-time)))
    (condition-case nil (while t (scroll-up) (redisplay))
      (error (message "GCs: %d Elapsed time: %f seconds"
                      (- gcs-done oldgc) (- (float-time) oldtime))))))