Skip to content

High CPU when using display-line-numbers-mode on Emacs 28.1 #31

@bk138

Description

@bk138

Describe the bug
When running good-scroll-mode together with display-line-numbers-mode, the CPU usage goes up to ~10% to 15% on my 2.6GHz CPU using Emacs 28.1 with native-comp. The window with the line numbers has to be active to see the behaviour. If I switch to another window after C-x 2 the CPU usage goes down. Giving focus to the window with line numbers: higher CPU again.

To Reproduce
Steps to reproduce the behavior:

  1. use the following ready-to-start (uses use-package) .emacs I prepared:
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(if (string-equal system-type "gnu/linux")
    (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")) ; make default https elpa usable again
(package-initialize)
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

;; configure use-package
(eval-when-compile
  (require 'use-package)
  (setq use-package-compute-statistics t)
  (require 'use-package-ensure)
  (setq use-package-always-ensure t))


(use-package good-scroll
  :config (good-scroll-mode 1))

(global-display-line-numbers-mode)
  1. open some text or source code file
  2. watch the CPU emacs consumes, should be quite high (for an idle text editor)
  3. disable display-line-numbers-mode
  4. watch the CPU emacs consumes, should be very low

Expected behavior
Low CPU usage with good-scroll and display-line-numbers-mode.

Videos
N/A

Version and environment

  • OS: Debian 11
  • Emacs version: GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0) of 2022-08-20, modified by Debian

Additional context
Uses native-comp, but I'm not sure if that matters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions