From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko 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 13:43:23 +0000 Message-ID: <87il52w744.fsf@localhost> References: <878r919qfh.fsf@localhost> <87il7izo4l.fsf@localhost> <831qe61xrh.fsf@gnu.org> <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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2201"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dmitry@gutov.dev, 66117@debbugs.gnu.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 13 14:41:10 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 1rDPU5-0000JK-AF for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 Dec 2023 14:41:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rDPTr-0002SH-PX; Wed, 13 Dec 2023 08:40:57 -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 1rDPTi-0002Ro-QE for bug-gnu-emacs@gnu.org; Wed, 13 Dec 2023 08:40:46 -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 1rDPTi-0003iM-0r for bug-gnu-emacs@gnu.org; Wed, 13 Dec 2023 08:40:46 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rDPTx-0006Ml-V8 for bug-gnu-emacs@gnu.org; Wed, 13 Dec 2023 08:41:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Dec 2023 13:41:01 +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.170247484524442 (code B ref 66117); Wed, 13 Dec 2023 13:41:01 +0000 Original-Received: (at 66117) by debbugs.gnu.org; 13 Dec 2023 13:40:45 +0000 Original-Received: from localhost ([127.0.0.1]:58427 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDPTg-0006M9-Tu for submit@debbugs.gnu.org; Wed, 13 Dec 2023 08:40:45 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:43559) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rDPTb-0006Lp-Ns for 66117@debbugs.gnu.org; Wed, 13 Dec 2023 08:40:43 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 6DD5D240029 for <66117@debbugs.gnu.org>; Wed, 13 Dec 2023 14:40:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1702474817; bh=Ahwa6LSvbh0ErGtV6yBQBq9JEjnD8HSnnLmfv6M8j/I=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=SeGWecSY0d/RivOlSBK+g+FxpWbqr99bv2qEty0w7klpMgoZmN+OTyjcg8PaDqK/n ahHcBgpys40I+3Ed71VfskI9GQHuQQlkSWAkz1BTFMGTlCzR5Od90nvuqTQlcPUqeH niObAyTHJIzHJjxn3uUMQxxpop56oz4ffQasZvT+8Psxo7IBm0db27sd96+JAxEh+l 4S3fjxUT42Bybccd1FurWS6l5xXTvAdzUmmnA87G9qszIz+ZE0b/FV4Zo+eRzGib6d oiAsOUCD8CJzSyNS4stDgRRu+EdgFcCDdqEVfecWBuWZTy4ZM8Z1SgcNnUQjyV943X MMBAMDB5FEK2A== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SqxSJ4h9bz6txX; Wed, 13 Dec 2023 14:40:16 +0100 (CET) In-Reply-To: <83jzpis08a.fsf@gnu.org> 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:276128 Archived-At: Eli Zaretskii writes: >> AFAIU, it is very hard to rewrite them in C, as I explained in >> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=66117#157 > > The only explanation I see there is that they "recursively call > other Elisp functions". Is there any other reason? The main problem I see is that `abbreviate-file-name' uses a number of variables, including customizations, defined in ELisp. I suspect that moving all of those to Elisp will neither be easy nor practical. > My point is that by trying to speed-up let-binding of case-fold-search > and similar variables you are trying to solve a much more general > problem, and a much harder one at that. IME, if an idea for a > solution leads to a more general and harder-to-solve problem than the > original, then the idea should be dropped, and one should look for > alternative ideas. The simplest solution would be what `ido-make-buffer-list-1' does: ;; 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) But it will only solve specific problem with `find-buffer-visiting' and we can always go for it if we cannot find anything better. I thought that trying to solve a more general problem would benefit more code - let-binding case-fold-search is extremely common across packages. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at