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: Tue, 12 Dec 2023 16:49:33 +0200 Message-ID: <83msuftr0i.fsf@gnu.org> References: <878r919qfh.fsf@localhost> <83pm2a5k85.fsf@gnu.org> <87wmwh2tae.fsf@localhost> <83zg1d468w.fsf@gnu.org> <87bkdr2651.fsf@localhost> <87pm2584oz.fsf@localhost> <83cyy11ln1.fsf@gnu.org> <87lecp84mf.fsf@localhost> <83ttrdx8j9.fsf@gnu.org> <87a5su261p.fsf@localhost> <838r8e24yy.fsf@gnu.org> <87y1gezspg.fsf@localhost> <834jj21z05.fsf@gnu.org> <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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27168"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dmitry@gutov.dev, 66117@debbugs.gnu.org To: Ihor Radchenko , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 12 15:51:09 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 1rD46H-0006sA-6d for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Dec 2023 15:51:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rD468-0002yV-D4; Tue, 12 Dec 2023 09:51:00 -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 1rD45w-0002le-8w for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 09:50:51 -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 1rD45v-0005pk-8p for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 09:50:48 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rD46A-0006vh-Kh for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 09:51: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: Tue, 12 Dec 2023 14:51: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.170239260626566 (code B ref 66117); Tue, 12 Dec 2023 14:51:02 +0000 Original-Received: (at 66117) by debbugs.gnu.org; 12 Dec 2023 14:50:06 +0000 Original-Received: from localhost ([127.0.0.1]:55621 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rD45F-0006uP-Eo for submit@debbugs.gnu.org; Tue, 12 Dec 2023 09:50:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57004) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rD45C-0006ti-ER for 66117@debbugs.gnu.org; Tue, 12 Dec 2023 09:50:03 -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 1rD44r-0004WP-2t; Tue, 12 Dec 2023 09:49:41 -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=0/X2lJfloobfZ2o13iC6q70TvnfsShUuusyh4TrHHa8=; b=TKW9fqc6x0SJ mrMoYRPEtRTFP3kU4lkH37RLbDzSWzX/5MM7bwswQu5ZUTiiUasBRdusv0Yf1gE5A6VBf8Htb3kM8 5X0e5cVcqa84iAt9X5oMh4pr5GJqlxJR6WGgDrZJrxH/bV23MK1kcCtkLjBElf4/yOhGnpLhE0Z0O KAZaZoC7z0RKaV5gYdCHt3vnOZgNlwzYcVvEvmYu0dzSDIFazz6zLBqaYljmS92d+z8Ko4Q4eCBHH q9xFaBbPILnEtGmaly3gAuW/aMkhFrwTCjAoRvEy0bPQv1Ae5PJhPzd4usdQOAMQmNOiMBKM38KEO TOqQsEoHUVIDiEUqOosMCg==; In-Reply-To: <87v8935wik.fsf@localhost> (message from Ihor Radchenko on Tue, 12 Dec 2023 14:24:35 +0000) 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:276050 Archived-At: > From: Ihor Radchenko > Cc: dmitry@gutov.dev, 66117@debbugs.gnu.org > Date: Tue, 12 Dec 2023 14:24:35 +0000 > > Ihor Radchenko writes: > > > Ihor Radchenko writes: > > > >> The main contributor is set_default_internal. I _suspect_ (because we > >> have non-linear scaling with the number of buffers - 3x increase in the > >> number of files lead to ~6x increase in the run time) that the main > >> contributor here is let-binding `case-fold-search' - special per-buffer > >> variable with no default value. > > > > My suspicion appears to be correct - removing let-binding for > > case-fold-search from `abbreviate-file-name' and > > `inhibit-local-variables-p' made them disappear from the top of the > > reverse call tree. > > > > Then, considering the ubiquity of let-binding case-fold-search across > > Elisp code, speeding up let-binding of special per-buffer variables may > > give us performance boost across Emacs. > > What do you think about introducing something like > > struct buffer buffer_overrides; > > It will be similar to buffer_defaults in buffer.c, but will hold the > overriding values of buffer-local variables that are to be used instead > of proper buffer-local variables. That way, we can speed up let-binding > of case-fold-search. I'm sorry, I don't think I understand how this will work and avoid the problems we have with let-binding. So I added Stefan, in the hope that he might understand what I am evidently missing.