From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#66117: 30.0.50; `find-buffer-visiting' is slow when opening large number of buffers Date: Wed, 13 Dec 2023 16:58:09 +0200 Message-ID: <83edfqrvy6.fsf@gnu.org> References: <878r919qfh.fsf@localhost> <87cyxqzmhh.fsf@localhost> <83zg0uzlgw.fsf@gnu.org> <87v8bhxzcu.fsf@localhost> <83y1gdxws8.fsf@gnu.org> <87jzrwm7ul.fsf@localhost> <87h6n0m781.fsf@localhost> <87v8935wik.fsf@localhost> <83msuftr0i.fsf@gnu.org> <87plzbxtxa.fsf@localhost> <87y1dzvvf0.fsf@localhost> <83plzas3pg.fsf@gnu.org> <87r0jqw8u9.fsf@localhost> <83jzpis08a.fsf@gnu.org> <87il52w744.fsf@localhost> <83fs06rz10.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19252"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dmitry@gutov.dev, yantar92@posteo.net, 66117@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 13 15:59:02 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rDQhS-0004jF-PM for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 Dec 2023 15:59:02 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rDQhE-0007t0-L8; Wed, 13 Dec 2023 09:58:48 -0500 Original-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 ) id 1rDQhD-0007sb-0U for bug-gnu-emacs@gnu.org; Wed, 13 Dec 2023 09:58:47 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rDQhC-0005Ey-Ok for bug-gnu-emacs@gnu.org; Wed, 13 Dec 2023 09:58:46 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rDQhS-0000cg-C2 for bug-gnu-emacs@gnu.org; Wed, 13 Dec 2023 09:59:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Dec 2023 14:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66117 X-GNU-PR-Package: emacs Original-Received: via spool by 66117-submit@debbugs.gnu.org id=B66117.17024795232366 (code B ref 66117); Wed, 13 Dec 2023 14:59:02 +0000 Original-Received: (at 66117) by debbugs.gnu.org; 13 Dec 2023 14:58:43 +0000 Original-Received: from localhost ([127.0.0.1]:59527 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDQh8-0000c5-HO for submit@debbugs.gnu.org; Wed, 13 Dec 2023 09:58:42 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55262) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDQh3-0000bo-7T for 66117@debbugs.gnu.org; Wed, 13 Dec 2023 09:58:40 -0500 Original-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 ) id 1rDQgg-0005Ae-Tz; Wed, 13 Dec 2023 09:58:14 -0500 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=VIOrqM7DNbh1YHsCTEKXwk3fWcL9DcaClghWfp3Mu48=; b=M5Kf0DibfyXH rXBaMAArbQT/+N1sTDRoODUX0NR5uP1YQXVWhy3vkN3uGiYz3NTuhvdjpdIgitNy1tP0YoOnn14rK UDvIx9vc1+gWYSCcB+ZdbMsrHVcE479eWfJL1us/GkljKS2rGUL1fJEUifBE5tgoi++SKqggYXthr JKIRrEQZyE42XHAGviyWwSJzqLVLwFdplkNO7cVSoXr4kgMIIoEsFE4wBIdm1P4vveHLWO7b85lqD /jtKXs1WVFccUZsEmDXX0LKgkapSEoKU9dPIcaDwBQrNA/haVk6l/Bzutj9o9yzPfjnoIqrxvlMy2 X0CR4Vz8dZZgSuiqIBPukg==; In-Reply-To: (message from Stefan Monnier on Wed, 13 Dec 2023 09:12:39 -0500) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:276139 Archived-At: > From: Stefan Monnier > Cc: Ihor Radchenko , dmitry@gutov.dev, > 66117@debbugs.gnu.org > Date: Wed, 13 Dec 2023 09:12:39 -0500 > > >> But it will only solve specific problem with `find-buffer-visiting' and > >> we can always go for it if we cannot find anything better. > > Which other popular functions need to loop through all the buffers in > > Lisp? > > Not sure why that matters. Because if using the setq-local trick solves this problem, we could do it in those other places as well. > The performance problem comes from repeated > uses of `(let ((case-fold-search ..)) ...)` where the repetition can be > due to anything (not only enumerating buffers). > > The "loop through buffers" happens when entering and leaving the `let`, > because it has to `set/unset` the corresponding filed of the `struct > buffer` of all the buffers whose `case-fold-search` is "global". That's not the loop through buffers I had in mind. I meant the loop in find-buffer-visiting.