Package: emacs;
Reported by: Rahguzar <rahguzar <at> mailbox.org>
Date: Sun, 13 Apr 2025 07:28:04 UTC
Severity: normal
Found in version 30.1
To reply to this bug, email your comments to 77775 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-gnu-emacs <at> gnu.org
:bug#77775
; Package emacs
.
(Sun, 13 Apr 2025 07:28:05 GMT) Full text and rfc822 format available.Rahguzar <rahguzar <at> mailbox.org>
:bug-gnu-emacs <at> gnu.org
.
(Sun, 13 Apr 2025 07:28:05 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: Rahguzar <rahguzar <at> mailbox.org> To: bug-gnu-emacs <at> gnu.org Subject: 30.1; Proced performance Date: Sun, 13 Apr 2025 12:08:04 +0500
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))
bug-gnu-emacs <at> gnu.org
:bug#77775
; Package emacs
.
(Sun, 13 Apr 2025 10:45:06 GMT) Full text and rfc822 format available.Message #8 received at 77775 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Rahguzar <rahguzar <at> mailbox.org>, Roland Winkler <winkler <at> gnu.org>, Laurence Warne <laurencewarne <at> gmail.com> Cc: 77775 <at> debbugs.gnu.org Subject: Re: bug#77775: 30.1; Proced performance Date: Sun, 13 Apr 2025 13:44:26 +0300
> 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 <at> gnu.org> > > > 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?
bug-gnu-emacs <at> gnu.org
:bug#77775
; Package emacs
.
(Sun, 13 Apr 2025 12:36:02 GMT) Full text and rfc822 format available.Message #11 received at 77775 <at> debbugs.gnu.org (full text, mbox):
From: Laurence Warne <laurencewarne <at> gmail.com> To: Eli Zaretskii <eliz <at> gnu.org> Cc: Rahguzar <rahguzar <at> mailbox.org>, Roland Winkler <winkler <at> gnu.org>, 77775 <at> debbugs.gnu.org Subject: Re: bug#77775: 30.1; Proced performance Date: Sun, 13 Apr 2025 13:36:31 +0100
[Message part 1 (text/plain, inline)]
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.
[Message part 2 (text/html, inline)]
bug-gnu-emacs <at> gnu.org
:bug#77775
; Package emacs
.
(Sun, 13 Apr 2025 13:50:03 GMT) Full text and rfc822 format available.Message #14 received at 77775 <at> debbugs.gnu.org (full text, mbox):
From: Roland Winkler <winkler <at> gnu.org> To: Eli Zaretskii <eliz <at> gnu.org> Cc: Laurence Warne <laurencewarne <at> gmail.com>, Rahguzar <rahguzar <at> mailbox.org>, 77775 <at> debbugs.gnu.org Subject: Re: bug#77775: 30.1; Proced performance 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. 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
bug-gnu-emacs <at> gnu.org
:bug#77775
; Package emacs
.
(Sun, 13 Apr 2025 14:27:03 GMT) Full text and rfc822 format available.Message #17 received at 77775 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: Roland Winkler <winkler <at> gnu.org> Cc: laurencewarne <at> gmail.com, rahguzar <at> mailbox.org, 77775 <at> debbugs.gnu.org Subject: Re: bug#77775: 30.1; Proced performance Date: Sun, 13 Apr 2025 17:26:12 +0300
> From: Roland Winkler <winkler <at> gnu.org> > Cc: Rahguzar <rahguzar <at> mailbox.org>, Laurence Warne > <laurencewarne <at> gmail.com>, 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.
bug-gnu-emacs <at> gnu.org
:bug#77775
; Package emacs
.
(Sun, 13 Apr 2025 14:48:02 GMT) Full text and rfc822 format available.Message #20 received at 77775 <at> debbugs.gnu.org (full text, mbox):
From: Roland Winkler <winkler <at> gnu.org> To: Eli Zaretskii <eliz <at> gnu.org> Cc: laurencewarne <at> gmail.com, rahguzar <at> mailbox.org, 77775 <at> debbugs.gnu.org Subject: Re: bug#77775: 30.1; Proced performance Date: Sun, 13 Apr 2025 09:47:37 -0500
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
bug-gnu-emacs <at> gnu.org
:bug#77775
; Package emacs
.
(Mon, 14 Apr 2025 04:43:03 GMT) Full text and rfc822 format available.Message #23 received at 77775 <at> debbugs.gnu.org (full text, mbox):
From: Azeem Hasan <rahguzar <at> mailbox.org> To: Laurence Warne <laurencewarne <at> gmail.com> Cc: Eli Zaretskii <eliz <at> gnu.org>, Rahguzar <rahguzar <at> mailbox.org>, Roland Winkler <winkler <at> gnu.org>, 77775 <at> debbugs.gnu.org Subject: Re: bug#77775: 30.1; Proced performance Date: Mon, 14 Apr 2025 09:17:23 +0500
Hi Laurence, Laurence Warne <laurencewarne <at> gmail.com> 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
bug-gnu-emacs <at> gnu.org
:bug#77775
; Package emacs
.
(Mon, 14 Apr 2025 04:43:04 GMT) Full text and rfc822 format available.Message #26 received at 77775 <at> debbugs.gnu.org (full text, mbox):
From: Azeem Hasan <rahguzar <at> mailbox.org> To: Roland Winkler <winkler <at> gnu.org> Cc: Eli Zaretskii <eliz <at> gnu.org>, Laurence Warne <laurencewarne <at> gmail.com>, 77775 <at> debbugs.gnu.org Subject: Re: bug#77775: 30.1; Proced performance Date: Mon, 14 Apr 2025 09:24:35 +0500
Hi Roland, Roland Winkler <winkler <at> gnu.org> 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
bug-gnu-emacs <at> gnu.org
:bug#77775
; Package emacs
.
(Mon, 14 Apr 2025 10:39:01 GMT) Full text and rfc822 format available.Message #29 received at 77775 <at> debbugs.gnu.org (full text, mbox):
From: Roland Winkler <winkler <at> gnu.org> To: Azeem Hasan <rahguzar <at> mailbox.org> Cc: Eli Zaretskii <eliz <at> gnu.org>, Laurence Warne <laurencewarne <at> gmail.com>, 77775 <at> debbugs.gnu.org Subject: Re: bug#77775: 30.1; Proced performance Date: Mon, 14 Apr 2025 05:38:26 -0500
On Mon, Apr 14 2025, Azeem Hasan wrote: > Looking at how the process-alist passed to `proced-format' is > constructed, I think a better change that preserves current behavior > would be: > > - (let ((standard-attributes > - (car (proced-process-attributes (list-system-processes)))) > + (let ((standard-attributes (car process-alist)) That's my point: The code used to be (let ((standard-attributes (car (proced-process-attributes (list (emacs-pid))))) and that's what the comment refers to that is still present in the code. Somehow, this got replaced by (let ((standard-attributes (car (proced-process-attributes (list-system-processes)))) and I want to find out what this change was supposed to accomplish. Your patch (let ((standard-attributes (car process-alist)) uses somewhat randomly the first process of process-alist.
bug-gnu-emacs <at> gnu.org
:bug#77775
; Package emacs
.
(Mon, 14 Apr 2025 10:56:01 GMT) Full text and rfc822 format available.Message #32 received at 77775 <at> debbugs.gnu.org (full text, mbox):
From: Rahguzar <rahguzar <at> mailbox.org> To: Roland Winkler <winkler <at> gnu.org> Cc: Eli Zaretskii <eliz <at> gnu.org>, Laurence Warne <laurencewarne <at> gmail.com>, 77775 <at> debbugs.gnu.org Subject: Re: bug#77775: 30.1; Proced performance Date: Mon, 14 Apr 2025 15:55:36 +0500
Hi Roland, Roland Winkler <winkler <at> gnu.org> writes: > That's my point: > > The code used to be > > (let ((standard-attributes > (car (proced-process-attributes (list (emacs-pid))))) > > and that's what the comment refers to that is still present in the code. > Somehow, this got replaced by > > (let ((standard-attributes > (car (proced-process-attributes (list-system-processes)))) > > and I want to find out what this change was supposed to accomplish. This was done in the commit e48ac2e2040 * Handle remote system processes in order to support remote processes. > Your patch > > (let ((standard-attributes (car process-alist)) > > uses somewhat randomly the first process of process-alist. which is the current behavior: the process that gets used is the one last in `list-system-processes' and that process is the first one in `process-alist'. Rahguzar
bug-gnu-emacs <at> gnu.org
:bug#77775
; Package emacs
.
(Sun, 01 Jun 2025 07:52:06 GMT) Full text and rfc822 format available.Message #35 received at 77775 <at> debbugs.gnu.org (full text, mbox):
From: Rahguzar <rahguzar <at> mailbox.org> To: 77775 <at> debbugs.gnu.org Cc: Eli Zaretskii <eliz <at> gnu.org>, Laurence Warne <laurencewarne <at> gmail.com>, Roland Winkler <winkler <at> gnu.org> Subject: Re: bug#77775: 30.1; Proced performance Date: Sun, 01 Jun 2025 12:51:12 +0500
Gentle ping! Is there any interest in this? Rahguzar <rahguzar <at> mailbox.org> writes: > Hi Roland, > > Roland Winkler <winkler <at> gnu.org> writes: > >> That's my point: >> >> The code used to be >> >> (let ((standard-attributes >> (car (proced-process-attributes (list (emacs-pid))))) >> >> and that's what the comment refers to that is still present in the code. >> Somehow, this got replaced by >> >> (let ((standard-attributes >> (car (proced-process-attributes (list-system-processes)))) >> >> and I want to find out what this change was supposed to accomplish. > > This was done in the commit > e48ac2e2040 * Handle remote system processes > in order to support remote processes. > >> Your patch >> >> (let ((standard-attributes (car process-alist)) >> >> uses somewhat randomly the first process of process-alist. > > which is the current behavior: the process that gets used is the one > last in `list-system-processes' and that process is the first one in > `process-alist'. > > Rahguzar
bug-gnu-emacs <at> gnu.org
:bug#77775
; Package emacs
.
(Sun, 01 Jun 2025 15:38:03 GMT) Full text and rfc822 format available.Message #38 received at 77775 <at> debbugs.gnu.org (full text, mbox):
From: Roland Winkler <winkler <at> gnu.org> To: Rahguzar <rahguzar <at> mailbox.org> Cc: Eli Zaretskii <eliz <at> gnu.org>, Laurence Warne <laurencewarne <at> gmail.com>, 77775 <at> debbugs.gnu.org Subject: Re: bug#77775: 30.1; Proced performance Date: Sun, 01 Jun 2025 10:37:21 -0500
On Sun, Jun 01 2025, Rahguzar wrote: > Gentle ping! Is there any interest in this? I am sorry, the delay is my fault, I have been swamped with other stuff. I'll try to catch up as quick as I can.
bug-gnu-emacs <at> gnu.org
:bug#77775
; Package emacs
.
(Wed, 04 Jun 2025 05:23:02 GMT) Full text and rfc822 format available.Message #41 received at 77775 <at> debbugs.gnu.org (full text, mbox):
From: Rahguzar <rahguzar <at> mailbox.org> To: Roland Winkler <winkler <at> gnu.org> Cc: Eli Zaretskii <eliz <at> gnu.org>, Laurence Warne <laurencewarne <at> gmail.com>, 77775 <at> debbugs.gnu.org Subject: Re: bug#77775: 30.1; Proced performance Date: Wed, 04 Jun 2025 10:22:02 +0500
[Message part 1 (text/plain, inline)]
Hi Roland, Roland Winkler <winkler <at> gnu.org> writes: > On Sun, Jun 01 2025, Rahguzar wrote: >> Gentle ping! Is there any interest in this? > > I am sorry, the delay is my fault, I have been swamped with other stuff. > I'll try to catch up as quick as I can. Please take your time. Meanwhile, I am attaching the patch I am proposing. Please review when it is convenient. Rahguzar
[0002-lisp-proced.el-Optimize-retrieval-of-process-attribu.patch (text/x-patch, attachment)]
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.