GNU logs - #77775, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#77775: 30.1; Proced performance
Resent-From: Rahguzar <rahguzar@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 13 Apr 2025 07:28:04 +0000
Resent-Message-ID: <handler.77775.B.174452927814054 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 77775
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 77775 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.174452927814054
          (code B ref -1); Sun, 13 Apr 2025 07:28:04 +0000
Received: (at submit) by debbugs.gnu.org; 13 Apr 2025 07:27:58 +0000
Received: from localhost ([127.0.0.1]:37908 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u3rkt-0003dQ-BT
	for submit <at> debbugs.gnu.org; Sun, 13 Apr 2025 03:27:58 -0400
Received: from lists.gnu.org ([2001:470:142::17]:43192)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rahguzar@HIDDEN>)
 id 1u3rS7-0008Iq-5w
 for submit <at> debbugs.gnu.org; Sun, 13 Apr 2025 03:08:30 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <rahguzar@HIDDEN>)
 id 1u3rS0-0003iN-6G
 for bug-gnu-emacs@HIDDEN; Sun, 13 Apr 2025 03:08:21 -0400
Received: from mout-p-201.mailbox.org ([80.241.56.171])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256)
 (Exim 4.90_1) (envelope-from <rahguzar@HIDDEN>)
 id 1u3rRw-0000JE-4u
 for bug-gnu-emacs@HIDDEN; Sun, 13 Apr 2025 03:08:19 -0400
Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4Zb1j50cp6z9sth
 for <bug-gnu-emacs@HIDDEN>; Sun, 13 Apr 2025 09:08:09 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org;
 s=mail20150812; t=1744528089;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type;
 bh=v4zKsjkdIw+Yqy1PPggvqsATufDLv01OLd1voQHK6gs=;
 b=C3yYt73faEVq+svL0B6Zj8AK4+V8h4jubqGh/hHxlsTT2rVyxqboZFZNQiIqzSvsxGnRG0
 vtVsEtSocHNEcqWGG+yDWb28Fd25SCA2VBpWmaaBzriq8ADuHPHOAzahmW6aTxdeGxPfXu
 haG2ybSmK1Ly//sxdy0wrDHtvR5cHPguRm5p/eSVCoC/kl4stQUixYkW23VErPmsunjp/6
 ZcVlcJ1B2ansXubypCGQ9tEHgts5KD57BZ8zZ0vPXhgIAoDgG6xAz18zWxXhqX4Q2IFPb4
 jPuwwAGCi135dWEdfky8+xrkaZFuzFsgdbFvJ8Nm/e0T9CZhuxWocLG9/PK5Yw==
From: Rahguzar <rahguzar@HIDDEN>
Date: Sun, 13 Apr 2025 12:08:04 +0500
Message-ID: <875xj835ez.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-MBO-RS-META: nbzemhjyrk6zifk3qoarmmhwjipww6p4
X-MBO-RS-ID: 130bd85713cb6b02973
Received-SPF: pass client-ip=80.241.56.171; envelope-from=rahguzar@HIDDEN;
 helo=mout-p-201.mailbox.org
X-Spam_score_int: -27
X-Spam_score: -2.8
X-Spam_bar: --
X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,
 RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Mailman-Approved-At: Sun, 13 Apr 2025 03:27:49 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)


Dear Emacs developers,

I sometimes see pauses when I have a proced buffer with auto update enabled. As a benchmark I tried
M-: (benchmark-run-compiled 100 (proced-update t t)) RET
(8.874007655 23 0.4591267360000001)

From profiler the what takes most time is:

1) Call to `proced-process-attributes' in `proced-update'. This is unavoidable.
2) Another call to `proced-process-attributes' in `proced-format'. This call gets attributes for all the process although it only need them for one.

I tried the diff
diff --git a/lisp/proced.el b/lisp/proced.el
index 51e6f3aca4d..c1a27cd0b15 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -1748,7 +1748,7 @@ proced-format
   ;; If none of the alternatives is non-nil, the attribute is ignored
   ;; in the listing.
   (let ((standard-attributes
-         (car (proced-process-attributes (list-system-processes))))
+         (car (proced-process-attributes (last (list-system-processes)))))
         new-format fmi)
     (if (and proced-tree-flag
              (assq 'ppid standard-attributes))

(The comment at the start of this diff is outdated)

After this:
M-: (benchmark-run-compiled 100 (proced-update t t)) RET
(5.910094172 18 0.4095661129999999)

3) `proced-format-pid' takes a lot of time. The culprit here is a call to `(process-attributes pid)'. To avoid it, I added a new variable `proced-format-current-process` which is let bound to the process being formatted in `proced-format'. This can then be used by format functions to look up other attributes if needed. The diff this time is larger:

diff --git a/lisp/proced.el b/lisp/proced.el
index c1a27cd0b15..42782615b33 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -428,6 +428,9 @@ proced-sort-internal
   "Sort scheme for listing (internal format).
 It is a list of lists (KEY PREDICATE REVERSE).")
 
+(defvar proced-format-current-process nil
+  "Symbol holding the process that is being formatted by function `proced-format'.")
+
 (defvar proced-marker-char ?*		; the answer is 42
   "In Proced, the current mark character.")
 
@@ -1682,13 +1685,13 @@ proced-format-state
 
 (defun proced-format-pid (pid)
   "Format PID."
-  (let ((proc-info (process-attributes pid))
-        (pid-s (number-to-string pid)))
+  (let ((pid-s (number-to-string pid)))
     (cond ((and proced-enable-color-flag
                 (not (file-remote-p default-directory))
                 (equal pid (emacs-pid)))
            (propertize pid-s 'font-lock-face 'proced-emacs-pid))
-          ((and proced-enable-color-flag (equal pid (alist-get 'sess proc-info)))
+          ((and proced-enable-color-flag
+                (equal pid (alist-get 'sess proced-format-current-process)))
            (propertize pid-s 'font-lock-face 'proced-session-leader-pid))
           (proced-enable-color-flag
            (propertize pid-s 'font-lock-face 'proced-pid))
@@ -1814,7 +1817,8 @@ proced-format
                  (end-of-line)
                  (setq value (cdr (assq key (cdr process))))
                  (insert (if value
-                             (apply #'propertize (funcall fun value) fprops)
+                             (let ((proced-format-current-process process))
+                               (apply #'propertize (funcall fun value) fprops))
                            (format (concat "%" (number-to-string (nth 3 grammar)) "s")
                                    unknown))
                          whitespace)
@@ -1828,7 +1832,9 @@ proced-format
                (dolist (process process-alist)
                  (end-of-line)
                  (setq value (cdr (assq key (cdr process))))
-                 (insert (if value (apply #'propertize (funcall fun value) fprops)
+                 (insert (if value
+                             (let ((proced-format-current-process process))
+                               (apply #'propertize (funcall fun value) fprops))
                            unknown))
                  (forward-line))
                (push (apply #'propertize (nth 1 grammar) hprops) header-list))
@@ -1839,7 +1845,8 @@ proced-format
                  (dolist (process process-alist)
                    (setq value (cdr (assq key (cdr process))))
                    (if value
-                       (setq value (apply #'propertize (funcall fun value) fprops)
+                       (setq value (let ((proced-format-current-process process))
+                                     (apply #'propertize (funcall fun value) fprops))
                              width (max width (length value))
                              field-list (cons value field-list))
                      (push unknown field-list)

but I think straightforward. Now:
M-: (benchmark-run-compiled 100 (proced-update t t)) RET
(4.046857128 16 0.441410039)

Together these two cut down the time `proced-update' by more than a half and the pauses are now much less noticeable.

Please let me know if these changes are acceptable and I will prepare a patch.

Thanks,
Rahguzar



In GNU Emacs 30.1 (build 1, aarch64-redhat-linux-gnu, GTK+ Version
 3.24.43, cairo version 1.18.2) of 2025-03-01 built on
 aebb4e0b2cb247d5ab04316e77c1c8ce
System Description: Fedora Linux Asahi Remix 41 (Forty One)

Configured using:
 'configure --build=aarch64-redhat-linux --host=aarch64-redhat-linux
 --program-prefix= --disable-dependency-tracking --prefix=/usr
 --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
 --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include
 --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var
 --runstatedir=/run --sharedstatedir=/var/lib --mandir=/usr/share/man
 --infodir=/usr/share/info --disable-gc-mark-trace --with-cairo
 --with-dbus --with-gif --with-gpm=no --with-harfbuzz --with-jpeg
 --with-modules --with-native-compilation=aot --with-pgtk --with-png
 --with-rsvg --with-sqlite3 --with-tiff --with-tree-sitter --with-webp
 --with-xpm build_alias=aarch64-redhat-linux
 host_alias=aarch64-redhat-linux CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O2
 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches
 -pipe -Wall -Werror=format-security
 -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS
 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
 -mbranch-protection=standard -fasynchronous-unwind-tables
 -fstack-clash-protection -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer ' 'LDFLAGS=-Wl,-z,relro -Wl,--as-needed
 -Wl,-z,pack-relative-relocs -Wl,-z,now
 -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1
 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' CXX=g++ 'CXXFLAGS=-O2
 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches
 -pipe -Wall -Werror=format-security
 -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS
 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
 -mbranch-protection=standard -fasynchronous-unwind-tables
 -fstack-clash-protection -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer '
 PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.utf8
  locale-coding-system: utf-8-unix

Major mode: mu4e:main

Minor modes in effect:
  windmove-mode: t
  corfu-history-mode: t
  corfu-popupinfo-mode: t
  server-mode: t
  mu4e-search-minor-mode: t
  mu4e-update-minor-mode: t
  mu4e-context-minor-mode: t
  dirvish-override-dired-mode: t
  satchel-mode: t
  nerd-icons-completion-mode: t
  marginalia-mode: t
  vertico-multiform-mode: t
  vertico-mode: t
  evil-goggles-mode: t
  anzu-mode: t
  evil-mode: t
  evil-local-mode: t
  recentf-mode: t
  savehist-mode: t
  save-place-mode: t
  electric-pair-mode: t
  override-global-mode: t
  pixel-scroll-precision-mode: t
  repeat-mode: t
  midnight-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  minibuffer-regexp-mode: t
  buffer-read-only: t
  size-indication-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  abbrev-mode: t

Load-path shadows:
/home/azeem/.local/state/emacs/elpaca/builds/transient/transient hides /usr/share/emacs/30.1/lisp/transient
/home/azeem/.local/state/emacs/elpaca/builds/ef-themes/theme-loaddefs hides /usr/share/emacs/30.1/lisp/theme-loaddefs

Features:
(shadow emacsbug proced windmove oc-basic ol-eww eww-hacks tex-mode
shell eww url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus
nnselect ol-docview ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi view
helpful cc-langs cc-vars cc-defs trace cl-print edebug debug backtrace
info-look info dash smerge-mode diff dabbrev delsel face-remap
nerd-icons-corfu consult-imenu vc-git diff-mode track-changes
vc-dispatcher fabs consult vertico-directory pdf-roll pdf-annot tablist
tablist-filter semantic/wisent/comp semantic/wisent
semantic/wisent/wisent semantic/util-modes semantic/util semantic
semantic/tag semantic/lex semantic/fw mode-local cedet pdf-outline
inspirehep-pdf companion-mode inspirehep reftex reftex-loaddefs
reftex-vars bibtex pdf-links pdf-isearch let-alist pdf-misc imenu
pdf-tools package pdf-view pdf-cache pdf-info tq pdf-util pdf-macs
help-fns radix-tree vertico-sort doc-view jka-compr undo-fu-session
dired-x dirvish-emerge dired-aux diredfl gnus-dired dirvish-subtree
dirvish-icons dirvish-widgets url-handlers jit-spell ispell cape
mastodon-media mastodon-profile mastodon-auth mastodon-client plstore
mastodon mastodon-transient tp mastodon-search mastodon-widget
mastodon-tl image-mode exif url-cache mastodon-toot multisession sqlite
facemenu mastodon-iso mastodon-http url-http url-auth url-gw link-hint
ffap goto-addr avy gnus-fun highlight-quoted corfu-history
corfu-popupinfo corfu evil-embrace embrace expand-region
text-mode-expansions the-org-mode-expansions org-element org-persist xdg
org-id org-refile org-element-ast inline avl-tree generator
er-basic-expansions expand-region-core expand-region-custom
evil-surround shr-color mm-archive qp sort smiley gnus-cite mail-extr
textsec uni-scripts idna-mapping ucs-normalize uni-confusable
textsec-check gnus-async gnus-bcklg visual-wrap gnus-ml disp-table
nndraft nnmh vertico-repeat epa-file network-stream nsm gnus-agent
gnus-srvr gnus-score score-mode nnvirtual nntp gnus-cache server mu4e
mu4e-org org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-src sh-script smie treesit executable ob-comint org-pcomplete
pcomplete org-list org-footnote org-faces org-entities noutline outline
org-version ob-emacs-lisp ob-core ob-eval org-cycle org-table ol
org-fold org-fold-core org-keys oc org-loaddefs find-func org-compat
org-macs mu4e-notification notifications mu4e-main smtpmail mu4e-view
mu4e-mime-parts crm cal-menu calendar cal-loaddefs mu4e-headers
mu4e-thread mu4e-actions mu4e-compose mu4e-draft gnus-msg gnus-art mm-uu
mml2015 mm-view mml-smime smime gnutls dig gnus-sum gnus-group gnus-undo
gnus-start gnus-dbus dbus gnus-cloud nnimap nnmail mail-source utf7 nnoo
parse-time iso8601 gnus-spec gnus-int gnus-range gnus-win gnus nnheader
range mu4e-search mu4e-lists mu4e-bookmarks mu4e-mark mu4e-message shr
pixel-fill kinsoku url-file svg xml dom browse-url flow-fill mule-util
hl-line mu4e-contacts mu4e-update mu4e-folders mu4e-context
mu4e-query-items mu4e-server mu4e-modeline mu4e-vars mu4e-helpers
mu4e-config mu4e-window ido message sendmail yank-media puny dirvish
transient format-spec cus-start autorevert filenotify dired
dired-loaddefs rfc822 mml mml-sec epa derived epg rfc6068 epg-config
gnus-util time-date mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils
gmm-utils mailheader mu4e-obsolete usher satchel ibuf-ext ibuffer
ibuffer-loaddefs bookmark nerd-icons-completion nerd-icons
nerd-icons-faces nerd-icons-data nerd-icons-data-mdicon
nerd-icons-data-flicon nerd-icons-data-codicon nerd-icons-data-devicon
nerd-icons-data-sucicon nerd-icons-data-wicon nerd-icons-data-faicon
nerd-icons-data-powerline nerd-icons-data-octicon
nerd-icons-data-pomicon nerd-icons-data-ipsicon marginalia
vertico-multiform vertico evil-goggles pulse color ef-spring-theme
ef-themes pdf-loader anzu advice evil evil-integration evil-maps
evil-commands reveal evil-jumps evil-command-window evil-types
evil-search evil-ex evil-macros evil-repeat evil-states evil-core comp
comp-cstr cl-extra help-mode comp-run comp-common evil-common rect
evil-vars edmacro kmacro orderless compat mastodon-autoloads
tp-autoloads yeetube-autoloads filechooser-autoloads wile-autoloads
usher-autoloads undo-fu-session-autoloads ef-themes-autoloads
jit-spell-autoloads satchel-autoloads pdf-tools-autoloads
tablist-autoloads xr-autoloads link-hint-autoloads avy-autoloads
yaml-mode-autoloads markdown-mode-autoloads magit-autoloads
magit-section-autoloads llama-autoloads inspirehep-autoloads
consult-hoogle-autoloads haskell-ng-mode-autoloads
geiser-guile-autoloads geiser-autoloads fabs-autoloads
companion-mode-autoloads eww-hacks-autoloads evil-embrace-autoloads
embrace-autoloads expand-region-autoloads evil-surround-autoloads
evil-nerd-commenter-autoloads evil-goggles-autoloads anzu-autoloads
evil-autoloads goto-chg-autoloads eshell-syntax-highlighting-autoloads
eat-autoloads package-lint-flymake-autoloads package-lint-autoloads
macrostep-autoloads helpful-autoloads dash-autoloads
highlight-quoted-autoloads dirvish-autoloads transient-autoloads
diredfl-autoloads trashed-autoloads vertico-autoloads
orderless-autoloads nerd-icons-completion-autoloads marginalia-autoloads
embark-consult-autoloads embark-autoloads nerd-icons-corfu-autoloads
nerd-icons-autoloads cape-autoloads corfu-autoloads consult-autoloads
password-store-autoloads with-editor-autoloads elpaca-log elpaca-ui
recentf tree-widget savehist saveplace elec-pair bind-key easy-mmode
pcase ibuf-macs elpaca-menu-elpa flymake project compile
text-property-search comint ansi-osc ansi-color warnings thingatpt
pixel-scroll cua-base ring repeat rx midnight cus-edit pp cus-load
wid-edit elpaca-menu-melpa url url-proxy url-privacy url-expand
url-methods url-history url-cookie generate-lisp-file url-domsuf
url-util url-parse auth-source eieio eieio-core cl-macs icons
password-cache json subr-x map byte-opt gv bytecomp byte-compile
url-vars mailcap elpaca-menu-org cl-seq elpaca elpaca-process
cl-loaddefs cl-lib elpaca-autoloads rmc iso-transl tooltip cconv eldoc
paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode
mwheel term/pgtk-win pgtk-win term/common-win touch-screen pgtk-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs theme-loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
gtk pgtk multi-tty move-toolbar make-network-process native-compile
emacs)

Memory information:
((conses 16 2800767 1018448) (symbols 48 55579 14)
 (strings 32 442784 42118) (string-bytes 1 104419678)
 (vectors 16 142884) (vector-slots 8 2364850 481311)
 (floats 8 2309 34438) (intervals 56 224392 6429) (buffers 992 81))




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Rahguzar <rahguzar@HIDDEN>
Subject: bug#77775: Acknowledgement (30.1; Proced performance)
Message-ID: <handler.77775.B.174452927814054.ack <at> debbugs.gnu.org>
References: <875xj835ez.fsf@HIDDEN>
X-Gnu-PR-Message: ack 77775
X-Gnu-PR-Package: emacs
Reply-To: 77775 <at> debbugs.gnu.org
Date: Sun, 13 Apr 2025 07:28:05 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 77775 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
77775: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D77775
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#77775: 30.1; Proced performance
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 13 Apr 2025 10:45:06 +0000
Resent-Message-ID: <handler.77775.B77775.174454108313796 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77775
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Rahguzar <rahguzar@HIDDEN>, Roland Winkler <winkler@HIDDEN>, Laurence Warne <laurencewarne@HIDDEN>
Cc: 77775 <at> debbugs.gnu.org
Received: via spool by 77775-submit <at> debbugs.gnu.org id=B77775.174454108313796
          (code B ref 77775); Sun, 13 Apr 2025 10:45:06 +0000
Received: (at 77775) by debbugs.gnu.org; 13 Apr 2025 10:44:43 +0000
Received: from localhost ([127.0.0.1]:39845 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u3upL-0003a0-S3
	for submit <at> debbugs.gnu.org; Sun, 13 Apr 2025 06:44:43 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:57046)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1u3upG-0003Y1-8W
 for 77775 <at> debbugs.gnu.org; Sun, 13 Apr 2025 06:44:37 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1u3upA-0005WS-KN; Sun, 13 Apr 2025 06:44:28 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=SDXHkmLXev5w+ljQb/zXi+dxaf8GevddkmUD7AVBs3U=; b=Wi2o0hVDGNRg
 Cpr2QjLGtKEm8c3eVFwUOJfPm2pxOQVZD2TWFQ4btIURU9D5WUa8FG5o4i3GlEurTiQGBdjOiN5vT
 cL70PFAZyJUB145kTOyLQHc6mz+zfoFb1t9lJbIt820si5QX53OHBRz5ijgw40ouPxuThyg2XAsoa
 iTJTDUjpK+I0rJKS2tITqeXpJX/y+OtaCuMmvcsqLpQRiZcwL9gbqZJncBXJLEcFtpe7hv+GWpbKm
 vBPR6/2nBd5mJKN/Smb7H5M591eCIOur2ipkUsXIQIlxhyNdXKf0JVfdg/Mg2vzsXKqXzy3oJP4JE
 edmyF80CWRLp4GgS23yPrA==;
Date: Sun, 13 Apr 2025 13:44:26 +0300
Message-Id: <86o6x0jq7p.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <875xj835ez.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN)
References: <875xj835ez.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sun, 13 Apr 2025 12:08:04 +0500
> From:  Rahguzar via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> 
> Dear Emacs developers,
> 
> I sometimes see pauses when I have a proced buffer with auto update enabled. As a benchmark I tried
> M-: (benchmark-run-compiled 100 (proced-update t t)) RET
> (8.874007655 23 0.4591267360000001)
> 
> >From profiler the what takes most time is:
> 
> 1) Call to `proced-process-attributes' in `proced-update'. This is unavoidable.
> 2) Another call to `proced-process-attributes' in `proced-format'. This call gets attributes for all the process although it only need them for one.
> 
> I tried the diff
> diff --git a/lisp/proced.el b/lisp/proced.el
> index 51e6f3aca4d..c1a27cd0b15 100644
> --- a/lisp/proced.el
> +++ b/lisp/proced.el
> @@ -1748,7 +1748,7 @@ proced-format
>    ;; If none of the alternatives is non-nil, the attribute is ignored
>    ;; in the listing.
>    (let ((standard-attributes
> -         (car (proced-process-attributes (list-system-processes))))
> +         (car (proced-process-attributes (last (list-system-processes)))))
>          new-format fmi)
>      (if (and proced-tree-flag
>               (assq 'ppid standard-attributes))
> 
> (The comment at the start of this diff is outdated)
> 
> After this:
> M-: (benchmark-run-compiled 100 (proced-update t t)) RET
> (5.910094172 18 0.4095661129999999)
> 
> 3) `proced-format-pid' takes a lot of time. The culprit here is a call to `(process-attributes pid)'. To avoid it, I added a new variable `proced-format-current-process` which is let bound to the process being formatted in `proced-format'. This can then be used by format functions to look up other attributes if needed. The diff this time is larger:
> 
> diff --git a/lisp/proced.el b/lisp/proced.el
> index c1a27cd0b15..42782615b33 100644
> --- a/lisp/proced.el
> +++ b/lisp/proced.el
> @@ -428,6 +428,9 @@ proced-sort-internal
>    "Sort scheme for listing (internal format).
>  It is a list of lists (KEY PREDICATE REVERSE).")
>  
> +(defvar proced-format-current-process nil
> +  "Symbol holding the process that is being formatted by function `proced-format'.")
> +
>  (defvar proced-marker-char ?*		; the answer is 42
>    "In Proced, the current mark character.")
>  
> @@ -1682,13 +1685,13 @@ proced-format-state
>  
>  (defun proced-format-pid (pid)
>    "Format PID."
> -  (let ((proc-info (process-attributes pid))
> -        (pid-s (number-to-string pid)))
> +  (let ((pid-s (number-to-string pid)))
>      (cond ((and proced-enable-color-flag
>                  (not (file-remote-p default-directory))
>                  (equal pid (emacs-pid)))
>             (propertize pid-s 'font-lock-face 'proced-emacs-pid))
> -          ((and proced-enable-color-flag (equal pid (alist-get 'sess proc-info)))
> +          ((and proced-enable-color-flag
> +                (equal pid (alist-get 'sess proced-format-current-process)))
>             (propertize pid-s 'font-lock-face 'proced-session-leader-pid))
>            (proced-enable-color-flag
>             (propertize pid-s 'font-lock-face 'proced-pid))
> @@ -1814,7 +1817,8 @@ proced-format
>                   (end-of-line)
>                   (setq value (cdr (assq key (cdr process))))
>                   (insert (if value
> -                             (apply #'propertize (funcall fun value) fprops)
> +                             (let ((proced-format-current-process process))
> +                               (apply #'propertize (funcall fun value) fprops))
>                             (format (concat "%" (number-to-string (nth 3 grammar)) "s")
>                                     unknown))
>                           whitespace)
> @@ -1828,7 +1832,9 @@ proced-format
>                 (dolist (process process-alist)
>                   (end-of-line)
>                   (setq value (cdr (assq key (cdr process))))
> -                 (insert (if value (apply #'propertize (funcall fun value) fprops)
> +                 (insert (if value
> +                             (let ((proced-format-current-process process))
> +                               (apply #'propertize (funcall fun value) fprops))
>                             unknown))
>                   (forward-line))
>                 (push (apply #'propertize (nth 1 grammar) hprops) header-list))
> @@ -1839,7 +1845,8 @@ proced-format
>                   (dolist (process process-alist)
>                     (setq value (cdr (assq key (cdr process))))
>                     (if value
> -                       (setq value (apply #'propertize (funcall fun value) fprops)
> +                       (setq value (let ((proced-format-current-process process))
> +                                     (apply #'propertize (funcall fun value) fprops))
>                               width (max width (length value))
>                               field-list (cons value field-list))
>                       (push unknown field-list)
> 
> but I think straightforward. Now:
> M-: (benchmark-run-compiled 100 (proced-update t t)) RET
> (4.046857128 16 0.441410039)
> 
> Together these two cut down the time `proced-update' by more than a half and the pauses are now much less noticeable.
> 
> Please let me know if these changes are acceptable and I will prepare a patch.

Roland and Laurence, any comments?




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#77775: 30.1; Proced performance
Resent-From: Laurence Warne <laurencewarne@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 13 Apr 2025 12:36:02 +0000
Resent-Message-ID: <handler.77775.B77775.17445477508349 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77775
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: Rahguzar <rahguzar@HIDDEN>, Roland Winkler <winkler@HIDDEN>, 77775 <at> debbugs.gnu.org
Received: via spool by 77775-submit <at> debbugs.gnu.org id=B77775.17445477508349
          (code B ref 77775); Sun, 13 Apr 2025 12:36:02 +0000
Received: (at 77775) by debbugs.gnu.org; 13 Apr 2025 12:35:50 +0000
Received: from localhost ([127.0.0.1]:40342 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u3wYu-0002AV-NU
	for submit <at> debbugs.gnu.org; Sun, 13 Apr 2025 08:35:49 -0400
Received: from mail-ua1-x92d.google.com ([2607:f8b0:4864:20::92d]:61560)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.84_2) (envelope-from <laurencewarne@HIDDEN>)
 id 1u3wYS-00023z-Al
 for 77775 <at> debbugs.gnu.org; Sun, 13 Apr 2025 08:35:21 -0400
Received: by mail-ua1-x92d.google.com with SMTP id
 a1e0cc1a2514c-86fbb48fc7fso1330860241.2
 for <77775 <at> debbugs.gnu.org>; Sun, 13 Apr 2025 05:35:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1744547714; x=1745152514; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=otRjHLh8N5nBYJIlhyH9V7+aOmMoFsZExiKIPyBptUc=;
 b=KqPdMlwifrMmr+AuHR6W9pPd5UYun3AFmPu+t7uJslg0kTHeD0CFIB6OgeuLC7/ayx
 IXC90J0JGnb9FHjyn91fwQhISFoLkD1aZKxPuC84MIUfmgTa8eo8G81igRipB15Az1v0
 S0d4qfTg6tZYhumJUly1Xpmk2ACWOk8ugT6aHOX1k4s28RB4nnFVQp4juyYYPx55E4db
 fHKLvl6/mM6P97B+XeES2eglNJQxIiTbAp39Q1wx3SycxwkQpVn9ALYrdT+gLqOeqhxt
 ZFHmyygLBYzSTZUopjnnL6bo35zb+Ve9xDI+MX5B8K5Mqz5e+SqVgsRMVtaXnlSdRWRJ
 tvHQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1744547714; x=1745152514;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=otRjHLh8N5nBYJIlhyH9V7+aOmMoFsZExiKIPyBptUc=;
 b=Xn0fFQYS4KA3PyabpCkfj/YAdYr+OOR0Ie1OvTqXmcTvrAhwoHixx7iXOF923uhEFB
 Ghcf/V9FGU1fbCclGygtOep4wPF1oqFfp1jb2v4wSufEmMqv9+kX8PD/FZFY9KcxWQp1
 kq963LkORpDmKJ0ubQUVAvcE7wDo3dTXJHQ/JZqrGQtTBj/Cy0DMocJVxZjevePR28Pn
 lFEIqqZrhWDjPjYlEKgMyugTgp/uMNzv9e4u9qSyA84DttzuN027hNoe4Se6pRb/Uq+T
 471ODLDD8sCmJRCmQU//gvZ1UsjIenqLo6pO89Zg8dJcD7S5IdRxqWB/4VmxHOTWESgK
 ST/A==
X-Forwarded-Encrypted: i=1;
 AJvYcCVv6w5mTHE+g7YYk2ZLANySKrcwnVgbCXYYF7hQaD4K8lb256KBuKRzVHzSpdqPjhyP3Sx67A==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzRlOBBXCUDBaKduG63kNUH11fqu1Fpn0JdypS9GPxB0DOOhion
 mh3+K+Lsk7E7pgRZX5QWSIXRZgdnHs3i03nPz2Q08ORBYxfmFB4YmEv6NpVvzwHE/qvmSDiS6Ip
 PNKBcnRV9TIezaWnLS5q1guvsgw4=
X-Gm-Gg: ASbGncsVlGHCI7bZr4I9jJb1u5H2pwc63t9iE5e5Hn77e6z7yRAHLfoXPNyiYfA9Shl
 V/HaKCq0F/jcvm+3WWcQqIDrBFrQ7UQ62ONtDhG1sxZj9FThN0J0q8pPZqlhuSI6Fg/6YDRZZHr
 Qv0qYZKOSIW+2SbH3SWJM=
X-Google-Smtp-Source: AGHT+IHHgAt9WoZZD2VNZg/fGFgJEFL1Oub02wlaEooTbQ1MjmvsTPw76m2QvLtKlZn79ULktpx7fKCwceKAYgdpGg0=
X-Received: by 2002:a05:6102:14a4:b0:4bb:d062:455 with SMTP id
 ada2fe7eead31-4c9e4d2e3dcmr6768682137.0.1744547714260; Sun, 13 Apr 2025
 05:35:14 -0700 (PDT)
MIME-Version: 1.0
References: <875xj835ez.fsf@HIDDEN> <86o6x0jq7p.fsf@HIDDEN>
In-Reply-To: <86o6x0jq7p.fsf@HIDDEN>
From: Laurence Warne <laurencewarne@HIDDEN>
Date: Sun, 13 Apr 2025 13:36:31 +0100
X-Gm-Features: ATxdqUFD1XgcL20_020tCbHE9xhB0okHyVHYF3K3_gHEOQosxxAA0riXOaf6VPY
Message-ID: <CAE2oLqgn9M4knYCe1rWrt8Qzgdf+K66TywW1qMRdmCKEvzaxaA@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000cd65750632a82a02"
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000cd65750632a82a02
Content-Type: text/plain; charset="UTF-8"

Nice work! I too get ~50% speed improvement after applying the patch.  At a
glance the approach makes sense to me, it would be nice if we could change
the FORMAT functions in proced-grammar-alist to take all the process info,
which would remove the need for the additional defvar, but I think that
would be a breaking change.

--000000000000cd65750632a82a02
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Nice work! I too get ~50% speed improvement after app=
lying the patch.=C2=A0 At a glance the approach makes sense to me, it would=
 be nice if we could change the  FORMAT functions in proced-grammar-alist t=
o take all the process info, which would remove the need for the additional=
 defvar, but I think that would be a breaking change.</div></div>

--000000000000cd65750632a82a02--




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#77775: 30.1; Proced performance
Resent-From: Roland Winkler <winkler@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 13 Apr 2025 13:50:03 +0000
Resent-Message-ID: <handler.77775.B77775.174455219219788 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77775
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: Laurence Warne <laurencewarne@HIDDEN>, Rahguzar <rahguzar@HIDDEN>, 77775 <at> debbugs.gnu.org
Received: via spool by 77775-submit <at> debbugs.gnu.org id=B77775.174455219219788
          (code B ref 77775); Sun, 13 Apr 2025 13:50:03 +0000
Received: (at 77775) by debbugs.gnu.org; 13 Apr 2025 13:49:52 +0000
Received: from localhost ([127.0.0.1]:41610 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u3xiY-00058o-Ai
	for submit <at> debbugs.gnu.org; Sun, 13 Apr 2025 09:49:51 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:58910)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <winkler@HIDDEN>) id 1u3xiT-00057P-GC
 for 77775 <at> debbugs.gnu.org; Sun, 13 Apr 2025 09:49:48 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <winkler@HIDDEN>)
 id 1u3xiN-0006s9-0e; Sun, 13 Apr 2025 09:49:39 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=e9J5yV1nGw2IjKZNd3GgE3Tt3sna+xQqDdGRXUvAjm8=; b=KIogNUQIvsR7WZIsS8wM
 65MPLzjnuvow0ik3y1M7emjUv8uZCWwlCjKI44QyDAfQlVm5UdrccjhupPyXc80982TDABHgVLhSt
 QN0OBRX4OQuiaeX5s/Cp1h9WF7dWpoG806tx5JCQNmaco23nW5Flsp5phyidMXJfIAcvI4j0nCjyW
 5PP1RLB73gh17s7dGeNRst48be5DACv+W9ZbR/nvqxDAcW0MfbxZPJdbhKMPvAg966i2r/rEdnlxi
 S1XyuITlGMYbI7jjXYBDWfX7Dh5vG6ALRi5QGb27jtrY5ec9NBLcJ0SHVreoxxbFTP0hCKyF5MUYx
 jsNhG7EEHVe1Ng==;
From: Roland Winkler <winkler@HIDDEN>
In-Reply-To: <86o6x0jq7p.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 13 Apr
 2025 13:44:26 +0300")
References: <875xj835ez.fsf@HIDDEN> <86o6x0jq7p.fsf@HIDDEN>
Date: Sun, 13 Apr 2025 08:49:20 -0500
Message-ID: <87y0w4893z.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

On Sun, Apr 13 2025, Eli Zaretskii wrote:
>>    ;; If none of the alternatives is non-nil, the attribute is ignored
>>    ;; in the listing.
>>    (let ((standard-attributes
>> -         (car (proced-process-attributes (list-system-processes))))
>> +         (car (proced-process-attributes (last (list-system-processes)))))
>>          new-format fmi)
>>      (if (and proced-tree-flag
>>               (assq 'ppid standard-attributes))
>> 
>> (The comment at the start of this diff is outdated)

Why is this comment outdated?  Previously, proced-format used emacs-pid
instead of (list-system-processes), which is obviously much faster.

I haven't been engaged in the development of proced.el for some time.
But I feel I need to look at the current code more carefully before I
can comment on this patch (and the problem it is supposed to fix) in a
meaningful way.

Roland




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#77775: 30.1; Proced performance
Resent-From: Eli Zaretskii <eliz@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 13 Apr 2025 14:27:03 +0000
Resent-Message-ID: <handler.77775.B77775.174455439029274 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77775
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Roland Winkler <winkler@HIDDEN>
Cc: laurencewarne@HIDDEN, rahguzar@HIDDEN, 77775 <at> debbugs.gnu.org
Received: via spool by 77775-submit <at> debbugs.gnu.org id=B77775.174455439029274
          (code B ref 77775); Sun, 13 Apr 2025 14:27:03 +0000
Received: (at 77775) by debbugs.gnu.org; 13 Apr 2025 14:26:30 +0000
Received: from localhost ([127.0.0.1]:43263 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u3yI2-0007c6-7i
	for submit <at> debbugs.gnu.org; Sun, 13 Apr 2025 10:26:30 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:40772)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1u3yHy-0007bj-9S
 for 77775 <at> debbugs.gnu.org; Sun, 13 Apr 2025 10:26:27 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1u3yHs-0003n1-0I; Sun, 13 Apr 2025 10:26:20 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=38M7+Jh79j2Y3uq8bQgJMVfec54CJ9pVpZt6j/7QsJ4=; b=gOJp2SEQ6AEn
 ZbDPgFkoGA8moNjgA0yj7gG6m9ARPOAHY3lxLPGmv/BVaZmE+wi3ysv79dnSxivTDFjg+EurFm9q4
 Cas6G4YpZ53a7MXMtcg2o/FWCBgPqoQkFawtPZvqKFr56dxjk5cffcz7nPwrKKK9DlZg/BxP6Zl8c
 U2UdE2cd86GTw5s6LElT+nT8sDBfJ9koin88ovpCxifc1j/0CXX5QL+YzsAhzq7hl3kfUn4adorSO
 kkWZ3TvU+uvWRC/sWrVovHrNRT/kCGUe4fphwhjGq/HA8b8JJPQCf0H4gPDgAaJUFo6W7tgCxLE8B
 iB5kdSL0uIxlHKW7f6vLAg==;
Date: Sun, 13 Apr 2025 17:26:12 +0300
Message-Id: <86a58kjfy3.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
In-Reply-To: <87y0w4893z.fsf@HIDDEN> (message from Roland Winkler on Sun, 13
 Apr 2025 08:49:20 -0500)
References: <875xj835ez.fsf@HIDDEN> <86o6x0jq7p.fsf@HIDDEN>
 <87y0w4893z.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Roland Winkler <winkler@HIDDEN>
> Cc: Rahguzar <rahguzar@HIDDEN>,  Laurence Warne
>  <laurencewarne@HIDDEN>,  77775 <at> debbugs.gnu.org
> Date: Sun, 13 Apr 2025 08:49:20 -0500
> 
> On Sun, Apr 13 2025, Eli Zaretskii wrote:
> >>    ;; If none of the alternatives is non-nil, the attribute is ignored
> >>    ;; in the listing.
> >>    (let ((standard-attributes
> >> -         (car (proced-process-attributes (list-system-processes))))
> >> +         (car (proced-process-attributes (last (list-system-processes)))))
> >>          new-format fmi)
> >>      (if (and proced-tree-flag
> >>               (assq 'ppid standard-attributes))
> >> 
> >> (The comment at the start of this diff is outdated)
> 
> Why is this comment outdated?  Previously, proced-format used emacs-pid
> instead of (list-system-processes), which is obviously much faster.

Your attribution is wrong: it wasn't me who wrote that, it was
Rahguzar.

> I haven't been engaged in the development of proced.el for some time.
> But I feel I need to look at the current code more carefully before I
> can comment on this patch (and the problem it is supposed to fix) in a
> meaningful way.

Thanks.




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#77775: 30.1; Proced performance
Resent-From: Roland Winkler <winkler@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 13 Apr 2025 14:48:02 +0000
Resent-Message-ID: <handler.77775.B77775.17445556691249 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77775
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Eli Zaretskii <eliz@HIDDEN>
Cc: laurencewarne@HIDDEN, rahguzar@HIDDEN, 77775 <at> debbugs.gnu.org
Received: via spool by 77775-submit <at> debbugs.gnu.org id=B77775.17445556691249
          (code B ref 77775); Sun, 13 Apr 2025 14:48:02 +0000
Received: (at 77775) by debbugs.gnu.org; 13 Apr 2025 14:47:49 +0000
Received: from localhost ([127.0.0.1]:43337 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u3yce-0000K4-RV
	for submit <at> debbugs.gnu.org; Sun, 13 Apr 2025 10:47:49 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:37698)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <winkler@HIDDEN>) id 1u3ycb-0000Jp-Ry
 for 77775 <at> debbugs.gnu.org; Sun, 13 Apr 2025 10:47:46 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <winkler@HIDDEN>)
 id 1u3ycV-0006z3-Oh; Sun, 13 Apr 2025 10:47:39 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=aRWZjw68Mog2N4C12ga/LLo3Els7mAVQmDI/kejGlPE=; b=lP7L2YWGtyK3LL+jy0u/
 xG1FxMU0nH1c+6C57OuGgTwDXTmHPXl+n5aEpqSCJwW0Ek2haYJEOtSli38vUJyCiNA957d6+FtXi
 WkHe1+vnGcoPnvE5gBnUxDGBqqfiUJ1TMzBaqz1iXF5geoK3B5/eoGsc0I1Y8uFMe8JLM41eZGk5H
 2g3sNQBfrOOtUozVr6z0zDo2jvGabW/GSHuE7whuLm9lkveNTcYPiuhCE9cyCSHzvRf+tXDH2REn4
 PVjxHUWJvnO3gMN4Prpw4n/sNR0B0V6jVGGrl9qxmokqdNGGQihdTGCkjbrXz+TZm68qi5TTsbSGc
 /z22MjnlpHzZQg==;
From: Roland Winkler <winkler@HIDDEN>
In-Reply-To: <86a58kjfy3.fsf@HIDDEN> (Eli Zaretskii's message of "Sun, 13 Apr
 2025 17:26:12 +0300")
References: <875xj835ez.fsf@HIDDEN> <86o6x0jq7p.fsf@HIDDEN>
 <87y0w4893z.fsf@HIDDEN> <86a58kjfy3.fsf@HIDDEN>
Date: Sun, 13 Apr 2025 09:47:37 -0500
Message-ID: <87h62s86eu.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

On Sun, Apr 13 2025, Eli Zaretskii wrote:
>> Why is this comment outdated?  Previously, proced-format used emacs-pid
>> instead of (list-system-processes), which is obviously much faster.
>
> Your attribution is wrong: it wasn't me who wrote that, it was
> Rahguzar.

Sure.  I only wanted to say that the code has evolved since I last
touched it.  So I want to look at it more carefully before I comment on
this patch.

Roland




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#77775: 30.1; Proced performance
Resent-From: Azeem Hasan <rahguzar@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 14 Apr 2025 04:43:03 +0000
Resent-Message-ID: <handler.77775.B77775.17446057388065 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77775
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Laurence Warne <laurencewarne@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, Rahguzar <rahguzar@HIDDEN>, Roland Winkler <winkler@HIDDEN>, 77775 <at> debbugs.gnu.org
Received: via spool by 77775-submit <at> debbugs.gnu.org id=B77775.17446057388065
          (code B ref 77775); Mon, 14 Apr 2025 04:43:03 +0000
Received: (at 77775) by debbugs.gnu.org; 14 Apr 2025 04:42:18 +0000
Received: from localhost ([127.0.0.1]:45232 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u4BeE-00025w-6s
	for submit <at> debbugs.gnu.org; Mon, 14 Apr 2025 00:42:18 -0400
Received: from mout-p-101.mailbox.org ([2001:67c:2050:0:465::101]:59824)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rahguzar@HIDDEN>)
 id 1u4BGL-0000l8-49
 for 77775 <at> debbugs.gnu.org; Mon, 14 Apr 2025 00:17:37 -0400
Received: from smtp102.mailbox.org (smtp102.mailbox.org
 [IPv6:2001:67c:2050:b231:465::102])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4ZbYsh6CxSz9tCG;
 Mon, 14 Apr 2025 06:17:28 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org;
 s=mail20150812; t=1744604248;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=ruRrj0UmK8EefEXx14BB+U+IR5iKGE3DAza/QMAbJpI=;
 b=KiHV111vTdYyhZzfvHHIMZYvQVNSVzl/otU0pxcN4mYGQ9qSExD1zVqmmbwaIxkAoDKOy1
 2TWinTUu9zSEj7MRO9aZnNErUym7cThq7/BiD3yo2kD0QGEWryiRdjVLj6LZ+3P12rvg9/
 tDvlVHqwqryoiuA9/dYxEla6CLaorr+UGP95f0lgm2VrahtcJ0xDuYeK9cN5KNHeEOS2U6
 fgDHQfyMQxA/OJQ1UEvuCOVmO0Jtfq4yi7nM6GHDlmm9dnsZB2xpPaAGVJ/h9YC4Mcx1u6
 80c9/1eb158FircxBRmhPzuCzylxbJPvxzeFGdZ36Y0z9y/921CvgJdbRGJmfA==
From: Azeem Hasan <rahguzar@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org;
 s=mail20150812; t=1744604247;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=ruRrj0UmK8EefEXx14BB+U+IR5iKGE3DAza/QMAbJpI=;
 b=Qv/KwveKiogD7d/en+E15a8jGXyGV6IRuiwPRVHgX1eBXxa/IXozuRKW7ZlCgZsZvUqW7f
 JWWz3oL9kSfhqbZxr8/cAppalRtFRI2WE3YoJcyWxAHm8+2lGGw8w7c5qBrwWCbS4meh2d
 L/hNP66RZUK2zn9if0KJAkWE3X0rufeV2yHSH3K0iA8kqEbm+Ql+obYpCQq2CDehd/tYpA
 nBd7M4JTXOhCqhXiMIwypjjLJ8rTCkb8Y+3AVSUwOQLeAgSs/mkXyFWutvaE+snKlROAv2
 6SRtO+pUwA7F4IKf4kHsI3fs6N+78cs/FkEoMpIpD6yYR6A+j51nfo+BgGkxWA==
In-Reply-To: <CAE2oLqgn9M4knYCe1rWrt8Qzgdf+K66TywW1qMRdmCKEvzaxaA@HIDDEN>
 (Laurence Warne's message of "Sun, 13 Apr 2025 13:36:31 +0100")
References: <875xj835ez.fsf@HIDDEN> <86o6x0jq7p.fsf@HIDDEN>
 <CAE2oLqgn9M4knYCe1rWrt8Qzgdf+K66TywW1qMRdmCKEvzaxaA@HIDDEN>
Date: Mon, 14 Apr 2025 09:17:23 +0500
Message-ID: <87v7r7xtpo.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-MBO-RS-META: gnetxyk7ojsufr5e1z6g6uhx8nmf77z3
X-MBO-RS-ID: b5f95163c65357b74b2
X-Rspamd-Queue-Id: 4ZbYsh6CxSz9tCG
X-Spam-Score: -0.7 (/)
X-Mailman-Approved-At: Mon, 14 Apr 2025 00:42:15 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Hi Laurence,

Laurence Warne <laurencewarne@HIDDEN> writes:

> Nice work! I too get ~50% speed improvement after applying the patch.  At a glance the approach makes sense to me, it would be nice if we could change the FORMAT functions in proced-grammar-alist to take all the process info, which would remove the need for the additional defvar, but I think that would be a breaking change.

The defvar is to preserve compatibility but even with it there can still
be some backward incompatibility if someone is use those format
functions outside of `proced-format'. I think that is highly unlikely
and worth it for the better performance, especially since the only
fallout from such a use will be that `proced-enable-color-flag' will not
be honored so I think it is a safe change.

Rahguzar




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#77775: 30.1; Proced performance
Resent-From: Azeem Hasan <rahguzar@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Mon, 14 Apr 2025 04:43:04 +0000
Resent-Message-ID: <handler.77775.B77775.17446057398073 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 77775
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Roland Winkler <winkler@HIDDEN>
Cc: Eli Zaretskii <eliz@HIDDEN>, Laurence Warne <laurencewarne@HIDDEN>, 77775 <at> debbugs.gnu.org
Received: via spool by 77775-submit <at> debbugs.gnu.org id=B77775.17446057398073
          (code B ref 77775); Mon, 14 Apr 2025 04:43:04 +0000
Received: (at 77775) by debbugs.gnu.org; 14 Apr 2025 04:42:19 +0000
Received: from localhost ([127.0.0.1]:45234 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u4BeE-000268-RI
	for submit <at> debbugs.gnu.org; Mon, 14 Apr 2025 00:42:19 -0400
Received: from mout-p-101.mailbox.org ([80.241.56.151]:39410)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <rahguzar@HIDDEN>)
 id 1u4BNI-00016e-Lh
 for 77775 <at> debbugs.gnu.org; Mon, 14 Apr 2025 00:24:49 -0400
Received: from smtp2.mailbox.org (smtp2.mailbox.org
 [IPv6:2001:67c:2050:b231:465::2])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
 (No client certificate requested)
 by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4ZbZ1z052tz9t8W;
 Mon, 14 Apr 2025 06:24:39 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org;
 s=mail20150812; t=1744604679;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=FeuY+MZXsKVd+qQ9GxEvI8YOkY//wz/DUupxsSDRkyk=;
 b=qrDVouiH4kc5+KcfKgoRTPH1qbcMHfzicUJSpTs0DvrzMTPmR8gTsl9xcmLps8uHBfUj2p
 o5332glLk7tMftBq/CqCRbxKF5EOS5n34zi5DTMDidzF7ePAHA/w82VTVncxs6216uA0yK
 1pULA1udBaV3o2nG+aEZ5n33gUcBFvJkEpcYxi65UN5k6ydaTRhIa+aiqLM8RYB0RisciQ
 lOaXuX5bt1Bpm1Uo+zV44z7bvKoJ1xQHggcYinrHyuSq3MlW5nSST+wnkYQrVaJJuc3oYr
 zMoO6CdbCJLODEl6aA5PiAdRmwhyUxG/jrXw+GMR3fekhlHsIgKjRfUzLbEp3A==
From: Azeem Hasan <rahguzar@HIDDEN>
In-Reply-To: <87y0w4893z.fsf@HIDDEN> (Roland Winkler's message of "Sun, 13
 Apr 2025 08:49:20 -0500")
References: <875xj835ez.fsf@HIDDEN> <86o6x0jq7p.fsf@HIDDEN>
 <87y0w4893z.fsf@HIDDEN>
Date: Mon, 14 Apr 2025 09:24:35 +0500
Message-ID: <87plhfxtdo.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-MBO-RS-META: qk54n3371k67y6ntfuxqzya5y9y8u48g
X-MBO-RS-ID: 5ba665c6e14fdf4d7b3
X-Spam-Score: -0.7 (/)
X-Mailman-Approved-At: Mon, 14 Apr 2025 00:42:15 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

Hi Roland,

Roland Winkler <winkler@HIDDEN> writes:

> On Sun, Apr 13 2025, Eli Zaretskii wrote:
>>>    ;; If none of the alternatives is non-nil, the attribute is ignored
>>>    ;; in the listing.
>>>    (let ((standard-attributes
>>> -         (car (proced-process-attributes (list-system-processes))))
>>> +         (car (proced-process-attributes (last (list-system-processes)))))
>>>          new-format fmi)
>>>      (if (and proced-tree-flag
>>>               (assq 'ppid standard-attributes))
>>> 
>>> (The comment at the start of this diff is outdated)
>
> Why is this comment outdated?  Previously, proced-format used emacs-pid
> instead of (list-system-processes), which is obviously much faster.

The comment talks about `emacs-pid' and I couldn't see how it is using
`emacs-pid' and was confused about it till I checked history and saw
that this used to be the case. Why is why I called it outdated. It is
likely to cause confusion for someone like me reading the code for the
first time.

Looking at how the process-alist passed to `proced-format' is
constructed, I think a better change that preserves current behavior
would be:

diff --git a/lisp/proced.el b/lisp/proced.el
index 51e6f3aca4d..f03213f5764 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -1747,8 +1747,7 @@ proced-format
   ;; attributes, we take the first attribute that is non-nil for `emacs-pid'.
   ;; If none of the alternatives is non-nil, the attribute is ignored
   ;; in the listing.
-  (let ((standard-attributes
-         (car (proced-process-attributes (list-system-processes))))
+  (let ((standard-attributes (car process-alist))
         new-format fmi)
     (if (and proced-tree-flag
              (assq 'ppid standard-attributes))


> I haven't been engaged in the development of proced.el for some time.
> But I feel I need to look at the current code more carefully before I
> can comment on this patch (and the problem it is supposed to fix) in a
> meaningful way.
>
> Roland

Rahguzar





Last modified: Mon, 14 Apr 2025 04:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.