From unknown Thu Sep 11 08:10:16 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#41029 <41029@debbugs.gnu.org> To: bug#41029 <41029@debbugs.gnu.org> Subject: Status: Improve ido-switch-buffer performance when many buffers are open Reply-To: bug#41029 <41029@debbugs.gnu.org> Date: Thu, 11 Sep 2025 15:10:16 +0000 retitle 41029 Improve ido-switch-buffer performance when many buffers are o= pen reassign 41029 emacs submitter 41029 Arnold Noronha severity 41029 wishlist tag 41029 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat May 02 12:04:16 2020 Received: (at submit) by debbugs.gnu.org; 2 May 2020 16:04:16 +0000 Received: from localhost ([127.0.0.1]:53739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUuch-00050t-LI for submit@debbugs.gnu.org; Sat, 02 May 2020 12:04:16 -0400 Received: from lists.gnu.org ([209.51.188.17]:59968) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUuGG-0004L1-0n for submit@debbugs.gnu.org; Sat, 02 May 2020 11:41:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60294) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUuGF-0006ws-EL for bug-gnu-emacs@gnu.org; Sat, 02 May 2020 11:41:03 -0400 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUuGC-0006d7-Kw for bug-gnu-emacs@gnu.org; Sat, 02 May 2020 11:41:03 -0400 Received: from tdrhq.com ([23.24.196.129]:33126) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jUuGC-0006YT-1a for bug-gnu-emacs@gnu.org; Sat, 02 May 2020 11:41:00 -0400 Received: by tdrhq.com (Postfix, from userid 1000) id 6FBD1C20CB6; Sat, 2 May 2020 08:40:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tdrhq.com; s=201909; t=1588434055; bh=zeTA8MFsjmGC/BLfHHbACsiGwlrJZnqK9r3fgrKtgUg=; h=Date:From:To:Subject:From; b=pECtenjuC/KvBvsmdeh+77aEhs4wLRWEeUWCboc5q5RLuRrXNS069FgcUdaYHDdjf RrtGhUyHFAFf6BzgdxStaGMp0lDoKhenmgzJzn3nH4uVxImNT2/DGnhgs77p9OVNcT JnaFJsSnWi9o6hYS1v980b6FxqcSomvgp8wwoHE2u/9JIJ+EUv0cLyGHMIBrAo++ko hnpnkqNYWyp4h1S8EDitgBGHWK+M9+IMdfaPHgVEPORP20SUeH5Q9aEYilwdWxEuaV KHR45PanuWUwIGCdGBe4+osdBBT4MWidO3RhpRujuu04e+F+ZLBSXF3WNEjarWCys8 xsqQ37R7Tiovw== Date: Sat, 2 May 2020 08:40:55 -0700 From: Arnold Noronha To: bug-gnu-emacs@gnu.org Subject: Improve ido-switch-buffer performance when many buffers are open Message-ID: <20200502154055.GA11238@tdrhq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Received-SPF: pass client-ip=23.24.196.129; envelope-from=arnold@tdrhq.com; helo=tdrhq.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/02 11:40:55 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 23.24.196.129 X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sat, 02 May 2020 12:04:14 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Many of the buffer locals (in particular I think it's the SYMBOL_FORWARDED types --- my terminoly may be off), appear to be O(n) to bind, where n is the number of live buffers. I tried to see if I can optimize that binding process directly, but couldn't figure out a way to do it without changing current behavior, so I opted to just optimize ido-switch-buffer directly. After this patch, the performance is quite bearable at ~6000 buffers, but still not ideal. --C7zPtVaVf+AK4Oqc Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Avoid-binding-CASE-FOLD-SEARCH-in-tight-loop.patch" >From 3bc4eb78c365f4b4a387451f0b55264076a97c4b Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Sat, 2 May 2020 08:30:47 -0700 Subject: [PATCH] Avoid binding CASE-FOLD-SEARCH in tight loop IDO-IGNORE-ITEM-P is called for every buffer when switching buffers. However, that function binds CASE-FOLD-SEARCH, which appears to be an O(n) operation where n is (length (buffer-list)). So we avoid binding it if we know we don't need to as a workaround. To test this, this this: (loop for i from 0 to 6000 do (find-file (format "/tmp/xy%d.txt" i))) Then try switching buffers with and without this patch. --- lisp/ido.el | 67 ++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/lisp/ido.el b/lisp/ido.el index 81883402ad..d7a24ae1d7 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -3408,7 +3408,7 @@ ido-make-merged-file-list (defun ido-make-buffer-list-1 (&optional frame visible) "Return list of non-ignored buffer names." (delq nil - (mapcar + (mapcar (lambda (x) (let ((name (buffer-name x))) (if (not (or (ido-ignore-item-p name ido-ignore-buffers) (member name visible))) @@ -3823,36 +3823,41 @@ ido-ignore-item-p (and ido-process-ignore-lists re-list (save-match-data - (let ((ext-list (and ignore-ext ido-ignore-extensions - completion-ignored-extensions)) - (case-fold-search ido-case-fold) - ignorep nextstr - (flen (length name)) slen) - (while ext-list - (setq nextstr (car ext-list)) - (if (cond - ((stringp nextstr) - (and (>= flen (setq slen (length nextstr))) - (string-equal (substring name (- flen slen)) nextstr))) - ((functionp nextstr) (funcall nextstr name)) - (t nil)) - (setq ignorep t - ext-list nil - re-list nil) - (setq ext-list (cdr ext-list)))) - (while re-list - (setq nextstr (car re-list)) - (if (cond - ((stringp nextstr) (string-match nextstr name)) - ((functionp nextstr) (funcall nextstr name)) - (t nil)) - (setq ignorep t - re-list nil) - (setq re-list (cdr re-list)))) - ;; return the result - (if ignorep - (setq ido-ignored-list (cons name ido-ignored-list))) - ignorep))))) + (flet ((inner () + (let ((ext-list (and ignore-ext ido-ignore-extensions + completion-ignored-extensions)) + ignorep nextstr + (flen (length name)) slen) + (while ext-list + (setq nextstr (car ext-list)) + (if (cond + ((stringp nextstr) + (and (>= flen (setq slen (length nextstr))) + (string-equal (substring name (- flen slen)) nextstr))) + ((functionp nextstr) (funcall nextstr name)) + (t nil)) + (setq ignorep t + ext-list nil + re-list nil) + (setq ext-list (cdr ext-list)))) + (while re-list + (setq nextstr (car re-list)) + (if (cond + ((stringp nextstr) (string-match nextstr name)) + ((functionp nextstr) (funcall nextstr name)) + (t nil)) + (setq ignorep t + re-list nil) + (setq re-list (cdr re-list)))) + ;; return the result + (if ignorep + (setq ido-ignored-list (cons name ido-ignored-list))) + ignorep))) + + (if (eq case-fold-search ido-case-fold) + (inner) + (let ((case-fold-search ido-case-fold)) + (inner)))))))) ;; Private variable used by `ido-word-matching-substring'. (defvar ido-change-word-sub) -- 2.20.1 --C7zPtVaVf+AK4Oqc-- From debbugs-submit-bounces@debbugs.gnu.org Sat May 02 13:07:09 2020 Received: (at 41029) by debbugs.gnu.org; 2 May 2020 17:07:09 +0000 Received: from localhost ([127.0.0.1]:53815 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUvbZ-0006gi-Fe for submit@debbugs.gnu.org; Sat, 02 May 2020 13:07:09 -0400 Received: from tdrhq.com ([23.24.196.129]:44192) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUv20-0005g7-Eu for 41029@debbugs.gnu.org; Sat, 02 May 2020 12:30:25 -0400 Received: by tdrhq.com (Postfix, from userid 1000) id 6ADB9C20CB6; Sat, 2 May 2020 09:30:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tdrhq.com; s=201909; t=1588437018; bh=4MiOqm9Vnv20nS/eDCT5h+VhSaAfnj6oOBYCmgaXalw=; h=Date:From:To:Subject:References:In-Reply-To:From; b=ExFbxxH1Wsx7M0MfOj8d1s6QJIvlf2fqiPjrQMn9CdIg3u7Umf/XcsFN7JS06mxbs rTyf2yzEy6lDxNibUR7zD+hWsWJcg5gY+duM9dJGhXXFUKC4GYKpF+YFRH7kQwieDq PZ9fH16H+rmPh5B7ecq28UZ3vGP2WnMewI/nTSonBEXKzpI8muaolthlTPvmIRH4W2 3CA0OoxEVH+FAJ7zC2ccAFJxzsqhqn/EwZgrwcM3NJwn4Wk/Dv4ZXlmIbsCUZkDNCj G+H6qipczno29mUyWMrdWwE1eiVWCE4AFuCdoYYxr3We5rnF8Q4IH2VkfIyrTj9sqB jXNC7QbBgWO3g== Date: Sat, 2 May 2020 09:30:18 -0700 From: Arnold Noronha To: 41029@debbugs.gnu.org Subject: Re: bug#41029: Acknowledgement (Improve ido-switch-buffer performance when many buffers are open) Message-ID: <20200502163018.GA6146@tdrhq.com> References: <20200502154055.GA11238@tdrhq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="9jxsPFA5p3P2qPhR" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41029 X-Mailman-Approved-At: Sat, 02 May 2020 13:07:08 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --9jxsPFA5p3P2qPhR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Updated patch (FLET was causing warnings/errors even though it seemed to work. I don't know enough of elisp's bootstrapping process to know why exactly.) --9jxsPFA5p3P2qPhR Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Avoid-binding-CASE-FOLD-SEARCH-in-tight-loop.patch" >From 3bb4ec9bb2ae503b059957e99234fb8155ca9857 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Sat, 2 May 2020 08:30:47 -0700 Subject: [PATCH] Avoid binding CASE-FOLD-SEARCH in tight loop IDO-IGNORE-ITEM-P is called for every buffer when switching buffers. However, that function binds CASE-FOLD-SEARCH, which appears to be an O(n) operation where n is (length (buffer-list)). So we avoid binding it if we know we don't need to as a workaround. To test this, this this: (loop for i from 0 to 6000 do (find-file (format "/tmp/xy%d.txt" i))) Then try switching buffers with and without this patch. --- lisp/ido.el | 67 ++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/lisp/ido.el b/lisp/ido.el index 81883402ad..a2394d1d37 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -3408,7 +3408,7 @@ ido-make-merged-file-list (defun ido-make-buffer-list-1 (&optional frame visible) "Return list of non-ignored buffer names." (delq nil - (mapcar + (mapcar (lambda (x) (let ((name (buffer-name x))) (if (not (or (ido-ignore-item-p name ido-ignore-buffers) (member name visible))) @@ -3823,36 +3823,41 @@ ido-ignore-item-p (and ido-process-ignore-lists re-list (save-match-data - (let ((ext-list (and ignore-ext ido-ignore-extensions - completion-ignored-extensions)) - (case-fold-search ido-case-fold) - ignorep nextstr - (flen (length name)) slen) - (while ext-list - (setq nextstr (car ext-list)) - (if (cond - ((stringp nextstr) - (and (>= flen (setq slen (length nextstr))) - (string-equal (substring name (- flen slen)) nextstr))) - ((functionp nextstr) (funcall nextstr name)) - (t nil)) - (setq ignorep t - ext-list nil - re-list nil) - (setq ext-list (cdr ext-list)))) - (while re-list - (setq nextstr (car re-list)) - (if (cond - ((stringp nextstr) (string-match nextstr name)) - ((functionp nextstr) (funcall nextstr name)) - (t nil)) - (setq ignorep t - re-list nil) - (setq re-list (cdr re-list)))) - ;; return the result - (if ignorep - (setq ido-ignored-list (cons name ido-ignored-list))) - ignorep))))) + (let ((inner (lambda () + (let ((ext-list (and ignore-ext ido-ignore-extensions + completion-ignored-extensions)) + ignorep nextstr + (flen (length name)) slen) + (while ext-list + (setq nextstr (car ext-list)) + (if (cond + ((stringp nextstr) + (and (>= flen (setq slen (length nextstr))) + (string-equal (substring name (- flen slen)) nextstr))) + ((functionp nextstr) (funcall nextstr name)) + (t nil)) + (setq ignorep t + ext-list nil + re-list nil) + (setq ext-list (cdr ext-list)))) + (while re-list + (setq nextstr (car re-list)) + (if (cond + ((stringp nextstr) (string-match nextstr name)) + ((functionp nextstr) (funcall nextstr name)) + (t nil)) + (setq ignorep t + re-list nil) + (setq re-list (cdr re-list)))) + ;; return the result + (if ignorep + (setq ido-ignored-list (cons name ido-ignored-list))) + ignorep)))) + + (if (eq case-fold-search ido-case-fold) + (funcall inner) + (let ((case-fold-search ido-case-fold)) + (funcall inner)))))))) ;; Private variable used by `ido-word-matching-substring'. (defvar ido-change-word-sub) -- 2.20.1 --9jxsPFA5p3P2qPhR-- From debbugs-submit-bounces@debbugs.gnu.org Sat May 02 13:07:10 2020 Received: (at 41029) by debbugs.gnu.org; 2 May 2020 17:07:10 +0000 Received: from localhost ([127.0.0.1]:53817 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUvbZ-0006gk-Pd for submit@debbugs.gnu.org; Sat, 02 May 2020 13:07:10 -0400 Received: from tdrhq.com ([23.24.196.129]:48322) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUvZv-0006dl-Gm for 41029@debbugs.gnu.org; Sat, 02 May 2020 13:05:27 -0400 Received: by tdrhq.com (Postfix, from userid 1000) id A43B2C20CB6; Sat, 2 May 2020 10:05:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tdrhq.com; s=201909; t=1588439121; bh=K160LmEGt1fDwSiI+sir0U7OW0u+j7OH89Gf3/3zAY0=; h=Date:From:To:Subject:References:In-Reply-To:From; b=mUrrXo1evZbRAqZRn+vbdU2yK8NWGX6Og17Rfo9ZQfA8wix6oum9s9egae0jAM2Xh oophgWG3kn/6xp7PaOrkw1utstRN1WpEJUq8YeX8kwJFwPzBV9K0aMhCSu6xo3hmtt ZBrqQi3TDLkt5SEgdnPxF4mSIjk67aryzLIy0VLB4MvQ2oIHXuunrfGLxLkrQFXjE5 2DZlTWJUjkPewaUomguV18Jmc0F7FYEFFQs00TT+1HIUJsye7k0qmg3JUzy80TNtPg yHHZN6zGwNJHROojemI3WgF6iHtaadhB2MzLklrldsCtch08ikAQbQsRQYlvBZUvlC KWav+P/7VXy5w== Date: Sat, 2 May 2020 10:05:21 -0700 From: Arnold Noronha To: 41029@debbugs.gnu.org Subject: Re: bug#41029: Improve ido-switch-buffer performance when many buffers are open Message-ID: <20200502170521.GA17319@tdrhq.com> References: <20200502154055.GA11238@tdrhq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="BXVAT5kNtrzKuDFl" Content-Disposition: inline In-Reply-To: <20200502154055.GA11238@tdrhq.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41029 X-Mailman-Approved-At: Sat, 02 May 2020 13:07:08 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --BXVAT5kNtrzKuDFl Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Sat, May 02, 2020 at 08:40:55AM -0700, Arnold Noronha wrote: > + (flet ((inner () Updated patch (FLET was causing warnings/errors even though it seemed to work. I don't know enough of elisp's bootstrapping process to know why exactly.) --BXVAT5kNtrzKuDFl Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Avoid-binding-CASE-FOLD-SEARCH-in-tight-loop.patch" >From 3bb4ec9bb2ae503b059957e99234fb8155ca9857 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Sat, 2 May 2020 08:30:47 -0700 Subject: [PATCH] Avoid binding CASE-FOLD-SEARCH in tight loop IDO-IGNORE-ITEM-P is called for every buffer when switching buffers. However, that function binds CASE-FOLD-SEARCH, which appears to be an O(n) operation where n is (length (buffer-list)). So we avoid binding it if we know we don't need to as a workaround. To test this, this this: (loop for i from 0 to 6000 do (find-file (format "/tmp/xy%d.txt" i))) Then try switching buffers with and without this patch. --- lisp/ido.el | 67 ++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/lisp/ido.el b/lisp/ido.el index 81883402ad..a2394d1d37 100644 --- a/lisp/ido.el +++ b/lisp/ido.el @@ -3408,7 +3408,7 @@ ido-make-merged-file-list (defun ido-make-buffer-list-1 (&optional frame visible) "Return list of non-ignored buffer names." (delq nil - (mapcar + (mapcar (lambda (x) (let ((name (buffer-name x))) (if (not (or (ido-ignore-item-p name ido-ignore-buffers) (member name visible))) @@ -3823,36 +3823,41 @@ ido-ignore-item-p (and ido-process-ignore-lists re-list (save-match-data - (let ((ext-list (and ignore-ext ido-ignore-extensions - completion-ignored-extensions)) - (case-fold-search ido-case-fold) - ignorep nextstr - (flen (length name)) slen) - (while ext-list - (setq nextstr (car ext-list)) - (if (cond - ((stringp nextstr) - (and (>= flen (setq slen (length nextstr))) - (string-equal (substring name (- flen slen)) nextstr))) - ((functionp nextstr) (funcall nextstr name)) - (t nil)) - (setq ignorep t - ext-list nil - re-list nil) - (setq ext-list (cdr ext-list)))) - (while re-list - (setq nextstr (car re-list)) - (if (cond - ((stringp nextstr) (string-match nextstr name)) - ((functionp nextstr) (funcall nextstr name)) - (t nil)) - (setq ignorep t - re-list nil) - (setq re-list (cdr re-list)))) - ;; return the result - (if ignorep - (setq ido-ignored-list (cons name ido-ignored-list))) - ignorep))))) + (let ((inner (lambda () + (let ((ext-list (and ignore-ext ido-ignore-extensions + completion-ignored-extensions)) + ignorep nextstr + (flen (length name)) slen) + (while ext-list + (setq nextstr (car ext-list)) + (if (cond + ((stringp nextstr) + (and (>= flen (setq slen (length nextstr))) + (string-equal (substring name (- flen slen)) nextstr))) + ((functionp nextstr) (funcall nextstr name)) + (t nil)) + (setq ignorep t + ext-list nil + re-list nil) + (setq ext-list (cdr ext-list)))) + (while re-list + (setq nextstr (car re-list)) + (if (cond + ((stringp nextstr) (string-match nextstr name)) + ((functionp nextstr) (funcall nextstr name)) + (t nil)) + (setq ignorep t + re-list nil) + (setq re-list (cdr re-list)))) + ;; return the result + (if ignorep + (setq ido-ignored-list (cons name ido-ignored-list))) + ignorep)))) + + (if (eq case-fold-search ido-case-fold) + (funcall inner) + (let ((case-fold-search ido-case-fold)) + (funcall inner)))))))) ;; Private variable used by `ido-word-matching-substring'. (defvar ido-change-word-sub) -- 2.20.1 --BXVAT5kNtrzKuDFl-- From debbugs-submit-bounces@debbugs.gnu.org Sat May 02 14:26:56 2020 Received: (at 41029) by debbugs.gnu.org; 2 May 2020 18:26:57 +0000 Received: from localhost ([127.0.0.1]:53906 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUwqa-0000Ky-MC for submit@debbugs.gnu.org; Sat, 02 May 2020 14:26:56 -0400 Received: from tdrhq.com ([23.24.196.129]:57338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jUwqY-0000Kj-UR for 41029@debbugs.gnu.org; Sat, 02 May 2020 14:26:43 -0400 Received: by tdrhq.com (Postfix, from userid 1000) id F377CC20CB6; Sat, 2 May 2020 11:26:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tdrhq.com; s=201909; t=1588443997; bh=ui05vpZkccqLjkEOzUavKioMsA/PcoP9jsdtvieFU0k=; h=Date:From:To:Subject:References:In-Reply-To:From; b=s2pBGCz3kjBmMkkPbV+P0hEwjpSqYwvLAuIhxBGLt87CjAmDleBs12hx90CTnNNiK C8W+bcKLozssvNUnE8QRLxxju7RsOhs7ZyFvqcrYrrsdPt1YuSyAjyvF608DTgjzZY PxwxY2Dg2xReOndpSsq1f8FO22AZ3+RQ1U1IHtsZicH5eo7Mz9yYOquO9ybE619VXX NITh0ayH+0wziyYw4721tEZIImctj0KrBD0DY5f8oFgKXhsxKqc493e4LtWBBnCu0q edLCiqp7o+Znr5UNpJUVD9Et68Y+xq4RRUm1S0ZMlOW4k0sZYZhSdYlEOFZXR1TjZB v5qwjoIXxq2EQ== Date: Sat, 2 May 2020 11:26:36 -0700 From: Arnold Noronha To: 41029@debbugs.gnu.org Subject: Re: bug#41029: Improve ido-switch-buffer performance when many buffers are open Message-ID: <20200502182636.GA9174@tdrhq.com> References: <20200502154055.GA11238@tdrhq.com> <20200502170521.GA17319@tdrhq.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="BOKacYhQ+x31HxR3" Content-Disposition: inline In-Reply-To: <20200502170521.GA17319@tdrhq.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41029 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 () > --BOKacYhQ+x31HxR3 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Use-a-temporary-buffer-before-calling-ido-ignore-ite.patch" >From 3dc513bc01decf9774f9ce5974abca30cbd71805 Mon Sep 17 00:00:00 2001 From: Arnold Noronha 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 --BOKacYhQ+x31HxR3-- From debbugs-submit-bounces@debbugs.gnu.org Sat May 02 22:03:21 2020 Received: (at 41029) by debbugs.gnu.org; 3 May 2020 02:03:21 +0000 Received: from localhost ([127.0.0.1]:54386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jV3yT-00040C-20 for submit@debbugs.gnu.org; Sat, 02 May 2020 22:03:21 -0400 Received: from mail-wm1-f50.google.com ([209.85.128.50]:54736) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jV3yQ-0003zy-Qz for 41029@debbugs.gnu.org; Sat, 02 May 2020 22:03:19 -0400 Received: by mail-wm1-f50.google.com with SMTP id h4so4430579wmb.4 for <41029@debbugs.gnu.org>; Sat, 02 May 2020 19:03:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=LKLHl4y6akJj1gDfdBASrQlBPN1QRgQXzFyeriSWQus=; b=m7uf7HXrXWU2HtYUbKQs3Sb7B4YVXAgm7x6Upttbzf89FOjXo3y3uGnOVVmE+KFua8 I0lc56hnsm3DKrKm+l1fu0Yd9AvCe+VBL4ZxRGkrKooap5BiAHU1SGEIlqrwlsgcoRcY IfoPa/mOm9KU81ZL1+DrCqUv8uIO6DzrIf6Ta7kJz4N33ljW17OvblPQZS1/MFajUbK4 oiIAgj/tGZSiHaaWaB6u4gkzb/oxX5ameO9D4CsmSx9glx15op79aJB1uOSYs6cyx7UE Z1kuxKQoGFpmOVcNugw5LnR+uO0TOjFyNUlIY/59urYMSFnlWCMGuC2seiFoL8zxp1Vu MBNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=LKLHl4y6akJj1gDfdBASrQlBPN1QRgQXzFyeriSWQus=; b=lBm9y9UUclnRUdIuD04dvyrEWr2SZEoJhH4nRNtCQzBWdTeg9DV+ZD6vYRx8MaADB0 p82wWDMDVVD1doNN0opAV2ylWeMBmnG7zAcpSOOP9bNRuar2Uea92S5H8XvInmO+Rmi3 kG3vzX45oGj14clCkJ5Wb4V4lFDMbr7duho8KrC/bpzv/bDOh+aXes1p6c2acrKDiUJY e2o9px4nPhNX98p13jiUNs+SHEmWrD/pJcuK34cZEVPuIcGiO74A7l1IrRzy1V/0d4z/ vywxYW00nqrLTrKabbVtrwuxvDqcBnJpHCuQueM5NqNtOIuLm+LAUBDRlU4YBtbU6O7y wQ/A== X-Gm-Message-State: AGi0PuaU1lLetypni59Ofot5Zkc8vZLVQsqRYxjyEap/NTkYUDLKPePl z0WJvtLPQdWOrliEUb1V7fjQ6mvUiT0= X-Google-Smtp-Source: APiQypI/0oDZSsH4sNqWYxMQVw0hbgg50LQLYeeB6lSNmL/aFf7IuotNa2aOTHVmk5Jc/T9xodfeWw== X-Received: by 2002:a1c:4ca:: with SMTP id 193mr7205172wme.18.1588471392838; Sat, 02 May 2020 19:03:12 -0700 (PDT) Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id p190sm6884652wmp.38.2020.05.02.19.03.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 02 May 2020 19:03:12 -0700 (PDT) Subject: Re: bug#41029: Improve ido-switch-buffer performance when many buffers are open To: Arnold Noronha , 41029@debbugs.gnu.org References: <20200502154055.GA11238@tdrhq.com> <20200502170521.GA17319@tdrhq.com> <20200502182636.GA9174@tdrhq.com> From: Dmitry Gutov Message-ID: Date: Sun, 3 May 2020 05:03:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200502182636.GA9174@tdrhq.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 41029 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 02.05.2020 21:26, Arnold Noronha wrote: > Actually, I realized this could be cleaner. Nicer patch attached. Looks fine to me, thanks. Unless someone expresses any objections in a week or so, we should install it. From debbugs-submit-bounces@debbugs.gnu.org Wed May 20 11:48:22 2020 Received: (at control) by debbugs.gnu.org; 20 May 2020 15:48:22 +0000 Received: from localhost ([127.0.0.1]:54065 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbQxB-0004sI-Of for submit@debbugs.gnu.org; Wed, 20 May 2020 11:48:21 -0400 Received: from mail-il1-f182.google.com ([209.85.166.182]:35622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jbQx9-0004s5-Ve for control@debbugs.gnu.org; Wed, 20 May 2020 11:48:20 -0400 Received: by mail-il1-f182.google.com with SMTP id a14so3606961ilk.2 for ; Wed, 20 May 2020 08:48:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=Pn4hhQvTgNVRTppFgKDLOsssGUabYCLGI7+z92BfvH4=; b=fBUiByNSuLZAjPbmGywNS1r8HB3iVu825RrfX7xu2BJ73SZkLpC3Eg2iOG7MNRKpY/ HRVAyN20nPii2DuFpiE7v8oosHGs57vxWt2G2Zety/xAmtVyqp8smxwdA3nV68DVpQIY 38ARH3T30zrhkFZA3RRjVFcJpR6NajFhT6yDhWXWH7M0YIOi0sluPVVBmRR4vo06KDJa KvnKOU9UK4JQqKqtyUKIdkb8MAE+LGppCnqXuoHyBUJKjstKUKpW07ydtCGsOKwqGXoX 75HbjkFEDgSUGmAf9pB4cT1sp4tzLw4EDOkrkQsW+BuaoBnAMcN4I3lAswDcWgC7LJG4 a1mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=Pn4hhQvTgNVRTppFgKDLOsssGUabYCLGI7+z92BfvH4=; b=rrQr+a1fqX7bt3eBLiocWQBEeMJLhMNjXC8Kw/8pxswEi77xLeHxElyNb02xfH+UOs dgk5kjj3e6iuldy6KJYc0nV3BIcnqIIuzlUpvTTtoHn+tzvsoA9V4sbkl6iEaRR843jY KjKKN00eJiIk8Z51ObfuKsLmxjZTIkPBpbsobKrnLfuxHvWX483cqH916rQHbrMMn6qd l51wTaIlwF7NssWxPPHrGHj4z/6ggBRL+q0lnoS132uDizZy4zGfTP9ssPc/iE7njIQT ffglV7WcsWTwwyeRkp2aJdaemgCupU9AKC1hecRMidJFsuc5VY9UXPMr+V3WHI7zvJlu M1/Q== X-Gm-Message-State: AOAM5300hwkvXAHU3mfs0XZBfvpWAvdWa5OYnGg7Y3hNkC/U6ZGkI9gF OLkYD2e03YpXF+UCO+yZ9cQzzQda X-Google-Smtp-Source: ABdhPJyopNSFaXLD4NfnE5synarBVah9BoLQNzVOGzhweR4xA8gYdB4GPrzDBpHkxOZs2x6xp0KOQg== X-Received: by 2002:a92:9e51:: with SMTP id q78mr4586712ili.268.1589989694166; Wed, 20 May 2020 08:48:14 -0700 (PDT) Received: from vhost2 (CPE001143542e1f-CMf81d0f809fa0.cpe.net.cable.rogers.com. [99.230.38.42]) by smtp.gmail.com with ESMTPSA id m17sm1520193ilh.51.2020.05.20.08.48.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 May 2020 08:48:13 -0700 (PDT) From: Noam Postavsky To: control@debbugs.gnu.org Subject: control message for bug #41410 Date: Wed, 20 May 2020 11:48:12 -0400 Message-ID: <85mu62ober.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) severity 41410 wishlist tags 41410 + patch tags 41239 + confirmed severity 41094 minor severity 41065 minor severity 41029 wishlist tags 41029 + patch severity 40972 minor severity 41328 wishlist severity 41225 wishlist quit From debbugs-submit-bounces@debbugs.gnu.org Thu May 28 19:36:41 2020 Received: (at 41029-done) by debbugs.gnu.org; 28 May 2020 23:36:42 +0000 Received: from localhost ([127.0.0.1]:53262 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeS4n-0007JE-Oo for submit@debbugs.gnu.org; Thu, 28 May 2020 19:36:41 -0400 Received: from mail-wm1-f49.google.com ([209.85.128.49]:54215) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jeS4m-0007J1-0k for 41029-done@debbugs.gnu.org; Thu, 28 May 2020 19:36:40 -0400 Received: by mail-wm1-f49.google.com with SMTP id l26so1065084wme.3 for <41029-done@debbugs.gnu.org>; Thu, 28 May 2020 16:36:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=e5ORDucjVru8V4ZZ4VCpCwPMLXciBoCqbr6qoMIlzug=; b=WcLzZcMj26jQktV+0QCENPWaVOY9ehUoaip8cVgovnTBtXTV2J3fp0OjnfjsJnNeAQ 4tn9TPnha3HVlhEszJ86xI0eDVeoq9qJeE/vRZgmESf3yHgY0vBxOfwzRNf6PO3sVW9l 8sGNrEwQUsvmGf6uMfNHvhqxtS2AvrBYV5Giidu5AnqCj+hJwcYJDeVWOSjYNjqwfeyg Vpjx+C6HljC2xzD3OXAeCowCO5shkqSwLw3n2tRdrGOy8WAVAySmSa007MGXszhOatEo Bwyto4J27fdtNnOFVeyFwIWx7LWF1lvxZjZFvXY/5ux24gsLIGFZ+GMKbiL8RtfkLDvB GMMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=e5ORDucjVru8V4ZZ4VCpCwPMLXciBoCqbr6qoMIlzug=; b=s7OufixoA5VHMZhVAj7+fiWzW6r7okws9KfkRQEpPr589QeFJDl2wV8RUV0zu/rLO5 1D1m1Z7KytquAxpbVKem9y4V8T0ATMuEPrpva9U0o2h8RoOc8GK7k/MEXUVg7zHk0l12 GoSgnlNcmiafTttuYd6F6/gbtPC2aVA4KLX/LEDJ3TJdgnmdWL93vi6kcsHXpayWQHFC i/J5q9aIj5y0oP6Ko/ZjU7aSDPcvEtiXvSp51LAzfvK65qeLfVkd+tIwqO/YXYQpjsrH 1zOg2vE/DEHWEg0w+7Dty3OMQrX//jmneln7+IC7HdarxUheqrMspTjA2kvfr5T84xdH OIkw== X-Gm-Message-State: AOAM531Y9fcFJKDkLLsShCXtKy5FkpanHDnosowSYmoxDivo/v4gC3d8 CBI0rKx+DBy4js8cXxPwjuSlmQc2 X-Google-Smtp-Source: ABdhPJxxWcmeZEi+Dgx9FCVeUHlfasQFObW0U2rN7U6wXmtT6n6JFKO1h2JpiZr6CaFc7Qzg9vIbKQ== X-Received: by 2002:a1c:a444:: with SMTP id n65mr5251487wme.99.1590708993770; Thu, 28 May 2020 16:36:33 -0700 (PDT) Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id d2sm7061055wrs.95.2020.05.28.16.36.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 May 2020 16:36:32 -0700 (PDT) Subject: Re: bug#41029: Improve ido-switch-buffer performance when many buffers are open From: Dmitry Gutov To: Arnold Noronha , 41029-done@debbugs.gnu.org References: <20200502154055.GA11238@tdrhq.com> <20200502170521.GA17319@tdrhq.com> <20200502182636.GA9174@tdrhq.com> Message-ID: <457d5c0e-8eb2-d1c3-27d6-aae2c9fc5047@yandex.ru> Date: Fri, 29 May 2020 02:36:31 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 41029-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) Version: 28.1 On 03.05.2020 05:03, Dmitry Gutov wrote: > On 02.05.2020 21:26, Arnold Noronha wrote: >> Actually, I realized this could be cleaner. Nicer patch attached. > > Looks fine to me, thanks. Unless someone expresses any objections in a > week or so, we should install it. Now pushed to master. Thank you! From unknown Thu Sep 11 08:10:16 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 26 Jun 2020 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator