all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#59935: 29.0.60; project-list-buffers is slow
@ 2022-12-10  1:49 Dmitry Gutov
  2022-12-10  2:03 ` Dmitry Gutov
                   ` (2 more replies)
  0 siblings, 3 replies; 49+ messages in thread
From: Dmitry Gutov @ 2022-12-10  1:49 UTC (permalink / raw)
  To: 59935; +Cc: juri

X-Debbugs-Cc: juri@linkov.net

When you invoke 'C-x p C-b', there's a noticeable pause before the
buffer list is displayed. It's ~400ms over here when there are 46
non-hidden buffers in the running session.

What I think is happening, the predicate is called 46, which in turn 
calls (project-buffers pr) 46 times, and that ends up being 46 times 
slower than one might have anticipated.

Not sure what's the best fix here (especially in time for the release),
but if the FILTER-PREDICATE arg to list-buffers-noselect turned into a
factory function (e.g. FILTER-PREDICATE-MAKER), that would be one
solution.

Another would be to only leave the legacy codepath: it's not affected,
project-buffers is only called once there.

Curiously, though, it shows a different list of buffers. It also
includes "hidden" buffers - diff-syntax, Echo Area, etc. We should look
into that either way.

And the patch is this:

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 016dfdd5b4..ad49df0423 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1342,16 +1342,13 @@ project-list-buffers
    (interactive "P")
    (let ((pr (project-current t)))
      (display-buffer
-     (if (version< emacs-version "29.0.50")
-         (let ((buf (list-buffers-noselect arg (project-buffers pr))))
-           (with-current-buffer buf
-             (setq-local revert-buffer-function
-                         (lambda (&rest _ignored)
-                           (list-buffers--refresh (project-buffers pr))
-                           (tabulated-list-print t))))
-           buf)
-       (list-buffers-noselect
-        arg nil (lambda (buf) (memq buf (project-buffers pr))))))))
+     (let ((buf (list-buffers-noselect arg (project-buffers pr))))
+       (with-current-buffer buf
+         (setq-local revert-buffer-function
+                     (lambda (&rest _ignored)
+                       (list-buffers--refresh (project-buffers pr))
+                       (tabulated-list-print t))))
+       buf))))
   (defcustom project-kill-buffer-conditions
    '(buffer-file-name    ; All file-visiting buffers are included.





^ permalink raw reply related	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2022-12-15 15:12 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-10  1:49 bug#59935: 29.0.60; project-list-buffers is slow Dmitry Gutov
2022-12-10  2:03 ` Dmitry Gutov
2022-12-10  8:11 ` Eli Zaretskii
2022-12-10 10:47   ` Dmitry Gutov
2022-12-10 11:12     ` Eli Zaretskii
2022-12-10 11:37       ` Dmitry Gutov
2022-12-10 14:33         ` Eli Zaretskii
2022-12-10 19:19           ` Dmitry Gutov
2022-12-10 19:42             ` Eli Zaretskii
2022-12-10 19:53               ` Dmitry Gutov
2022-12-10 20:11                 ` Eli Zaretskii
2022-12-10 20:23                   ` Dmitry Gutov
2022-12-11  6:19                     ` Eli Zaretskii
2022-12-11 10:23                       ` Dmitry Gutov
2022-12-11 10:54                         ` Eli Zaretskii
2022-12-11 16:32                           ` Dmitry Gutov
2022-12-12 10:36                   ` Jean Louis
2022-12-12 17:12                     ` Juri Linkov
2022-12-13  3:10                       ` Jean Louis
2022-12-12 19:58                     ` Dmitry Gutov
2022-12-13  3:10                       ` Jean Louis
2022-12-13 15:29                         ` Dmitry Gutov
2022-12-13 19:30                           ` Jean Louis
2022-12-13 20:31                             ` Dmitry Gutov
2022-12-15 14:58                               ` Jean Louis
2022-12-15 15:12                                 ` Dmitry Gutov
2022-12-10 17:45 ` Juri Linkov
2022-12-10 19:22   ` Dmitry Gutov
2022-12-11 17:07     ` Juri Linkov
2022-12-11 17:49       ` Eli Zaretskii
2022-12-11 17:56         ` Juri Linkov
2022-12-11 18:08           ` Eli Zaretskii
2022-12-11 18:13             ` Dmitry Gutov
2022-12-11 18:12         ` Dmitry Gutov
2022-12-11 18:17           ` Eli Zaretskii
2022-12-11 18:35             ` Dmitry Gutov
2022-12-11 19:00               ` Eli Zaretskii
2022-12-11 19:41                 ` Dmitry Gutov
2022-12-11 20:42                   ` Eli Zaretskii
2022-12-12 17:16                     ` Juri Linkov
2022-12-12 17:27                       ` Eli Zaretskii
2022-12-12 17:51                         ` Juri Linkov
2022-12-12 18:10                           ` Eli Zaretskii
2022-12-12 18:14                             ` Juri Linkov
2022-12-12 18:22                               ` Eli Zaretskii
2022-12-13 17:49                                 ` Juri Linkov
2022-12-11 18:37       ` Dmitry Gutov
2022-12-13 17:49         ` Juri Linkov
2022-12-13 18:51           ` Dmitry Gutov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.