Subject: bug#28704: closed (Re: bug#28704: 27.0.50; Sorting packages list slow when using display-line-numbers-type visual)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 05 Oct 2017 09:45:02 +0000

Your bug report

#28704: 27.0.50; Sorting packages list slow when using display-line-numbers-type visual

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
28704: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=28704
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#28704: 27.0.50; Sorting packages list slow when using display-line-numbers-type visual
From: Eli Zaretskii <[email-masked]>
To: martin rudalics <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Thu, 05 Oct 2017 12:43:43 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> Date: Thu, 05 Oct 2017 10:09:25 +0200
> From: martin rudalics <[email-masked]>
> 
> ‘tabulated-list-print’ should calculate ‘line-number-display-width’ once
> and ‘tabulated-list-line-number-width’ should use that value.

Indeed, thanks.  I've made a similar change on the release branch.

Subject: 27.0.50; Sorting packages list slow when using display-line-numbers-type visual
From: Joseph Garvin <[email-masked]>
To: [email-masked]
Date: Wed, 04 Oct 2017 11:14:56 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Starting with emacs -Q:

Evaluate this in the scratch buffer:

;; make the packages list long enough to notice
(when (>= emacs-major-version 24)
  (require 'package)
  (package-initialize)
  (setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
                           ("marmalade" . "https://marmalade-repo.org/packages/")
                           ("melpa-stable" . "http://stable.melpa.org/packages/")
                           ("melpa" . "https://melpa.org/packages/")))
  (when (not (package-installed-p 'use-package))
    (package-refresh-contents)
    (package-install 'use-package)))

;; enable mode to cause the problem
(when (>= emacs-major-version 26)
  (global-display-line-numbers-mode)
  (setq display-line-numbers-type 'visual))

Then run: M-x list-packages

Then click on one of the column headers to trigger sorting by that
column, e.g. Status. Emacs will freeze for a couple of minutes.

Profiler reveals:

- command-execute                                               25144  98%
 - call-interactively                                           25144  98%
  - funcall-interactively                                       25144  98%
   - tabulated-list-col-sort                                    24960  97%
    - tabulated-list--sort-by-column-name                       24960  97%
     - tabulated-list-print                                     24956  97%
      - apply                                                   24916  97%
       - tabulated-list-print-entry                             24903  97%
        - tabulated-list-line-number-width                      24736  96%
           #<compiled 0x2a38871>                                    2   0%

So it looks like all of the time is spent inside tabulated-list-line-number-width.

In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.14.13)
 of 2017-10-03 built on rdx-ws-030
Repository revision: 92045f4546b9708dc9f69954799d211c1f56ff1e
Windowing system distributor 'The X.Org Foundation', version 11.0.11702000
System Description:	CentOS Linux release 7.3.1611 (Core)

Recent messages:
No more unseen articles
Mark set [4 times]
Quit
Type "q" in help window to restore its previous buffer, C-M-v to scroll help.
nnimap read 0k from imap.gmail.com
Saving file /home/jgarvin/.newsrc-dribble...
Wrote /home/jgarvin/.newsrc-dribble [2 times]
(Saved .newsrc-dribble)
Making find-file-hook buffer-local while locally let-bound!
Giving new frame mandimus cursor color. [3 times]

Configured using:
 'configure --prefix=/home/jgarvin/opt --with-x-toolkit=gtk3'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  recentf-mode: t
  global-subword-mode: t
  subword-mode: t
  drag-stuff-global-mode: t
  drag-stuff-mode: t
  winpoint-mode: t
  delete-selection-mode: t
  global-hl-line-mode: t
  global-display-line-numbers-mode: t
  display-line-numbers-mode: t
  helm-mode: t
  savehist-mode: t
  save-place-mode: t
  erc-services-mode: t
  show-smartparens-global-mode: t
  show-smartparens-mode: t
  smartparens-global-mode: t
  smartparens-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-netsplit-mode: t
  erc-hl-nicks-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  projectile-global-mode: t
  projectile-mode: t
  diff-auto-refine-mode: t
  magit-auto-revert-mode: t
  global-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  helm-autoresize-mode: t
  override-global-mode: t
  cl-old-struct-compat-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  global-visual-line-mode: t
  visual-line-mode: t
  transient-mark-mode: t
  hs-minor-mode: t

Load-path shadows:
None found.

Features:
(shadow emacsbug helm-command helm-elisp helm-eval edebug eieio-opt
speedbar sb-image ezimage dframe help-fns radix-tree qp shr-color
rfc2104 cl-print debug mailalias smtpmail sendmail sort gnus-cite smiley
mail-extr gnus-async gnus-bcklg nnir winner gnus-ml nndraft nnmh
nnfolder utf-7 gnus-agent gnus-srvr gnus-score score-mode nnvirtual
gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig nntp
gnus-cache gnus-sum gnus-group gnus-undo gnus-start gnus-cloud nnimap
nnmail mail-source utf7 netrc nnoo gnus-spec gnus-int gnus-range
gnus-win gnus nnheader time cc-mode-expansions cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs vc-git
elec-pair cus-edit cus-start cus-load hexl rect md-belt-impl misc paren
tramp-cache tramp-sh recentf tree-widget cap-words superword subword
drag-stuff winpoint delsel hl-line cyberpunk-theme ...)

Memory information:
((conses 16 808014 278796)
 (symbols 48 65569 8)
 (miscs 40 345 1483)
 (strings 32 196288 21363)
 (string-bytes 1 6314604)
 (vectors 16 106791)
 (vector-slots 8 2268095 150701)
 (floats 8 639 1928)
 (intervals 56 1103 789)
 (buffers 992 45)
 (heap 1024 96654 13947))