From: Arnold Noronha <arnold@tdrhq.com>
To: 41029@debbugs.gnu.org
Subject: bug#41029: Improve ido-switch-buffer performance when many buffers are open
Date: Sat, 2 May 2020 11:26:36 -0700 [thread overview]
Message-ID: <20200502182636.GA9174@tdrhq.com> (raw)
In-Reply-To: <20200502170521.GA17319@tdrhq.com>
[-- Attachment #1: Type: text/plain, Size: 243 bytes --]
Actually, I realized this could be cleaner. Nicer patch attached.
--Arnold
On Sat, May 02, 2020 at 10:05:21AM -0700, Arnold Noronha wrote:
>
> On Sat, May 02, 2020 at 08:40:55AM -0700, Arnold Noronha wrote:
> > + (flet ((inner ()
>
[-- Attachment #2: 0001-Use-a-temporary-buffer-before-calling-ido-ignore-ite.patch --]
[-- Type: text/x-diff, Size: 1711 bytes --]
From 3dc513bc01decf9774f9ce5974abca30cbd71805 Mon Sep 17 00:00:00 2001
From: Arnold Noronha <arnold@tdrhq.com>
Date: Sat, 2 May 2020 11:24:22 -0700
Subject: [PATCH] Use a temporary-buffer before calling ido-ignore-item-p
multiple times
And locally set CASE-FOLD-SEARCH. Setting CASE-FOLD-SEARCH 1000s of
times if CASE-FOLD-SEARCH is not locally set is super slow because it
would have to update the bindings in each buffer (or, that is my
understanding. See the warning at:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Intro-to-Buffer_002dLocal.html#Intro-to-Buffer_002dLocal)
---
lisp/ido.el | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/lisp/ido.el b/lisp/ido.el
index 81883402ad..22b3729097 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -3407,13 +3407,18 @@ ido-make-merged-file-list
(defun ido-make-buffer-list-1 (&optional frame visible)
"Return list of non-ignored buffer names."
- (delq nil
- (mapcar
- (lambda (x)
- (let ((name (buffer-name x)))
- (if (not (or (ido-ignore-item-p name ido-ignore-buffers) (member name visible)))
- name)))
- (buffer-list frame))))
+ (with-temp-buffer
+ ;; Each call to ido-ignore-item-p LET-binds case-fold-search.
+ ;; That is slow if there's no buffer-local binding available,
+ ;; roughly O(number of buffers). This hack avoids it.
+ (setq-local case-fold-search nil)
+ (delq nil
+ (mapcar
+ (lambda (x)
+ (let ((name (buffer-name x)))
+ (if (not (or (ido-ignore-item-p name ido-ignore-buffers) (member name visible)))
+ name)))
+ (buffer-list frame)))))
(defun ido-make-buffer-list (default)
"Return the current list of buffers.
--
2.20.1
next prev parent reply other threads:[~2020-05-02 18:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-02 15:40 bug#41029: Improve ido-switch-buffer performance when many buffers are open Arnold Noronha
[not found] ` <handler.41029.B.158843545619280.ack@debbugs.gnu.org>
2020-05-02 16:30 ` bug#41029: Acknowledgement (Improve ido-switch-buffer performance when many buffers are open) Arnold Noronha
2020-05-02 17:05 ` bug#41029: Improve ido-switch-buffer performance when many buffers are open Arnold Noronha
2020-05-02 18:26 ` Arnold Noronha [this message]
2020-05-03 2:03 ` Dmitry Gutov
2020-05-28 23:36 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200502182636.GA9174@tdrhq.com \
--to=arnold@tdrhq.com \
--cc=41029@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.