From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" 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 15:01:56 -0500 Message-ID: References: <878r919qfh.fsf@localhost> <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> <83msuftr0i.fsf@gnu.org> <87plzbxtxa.fsf@localhost> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39837"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: dmitry@gutov.dev, Eli Zaretskii , 66117@debbugs.gnu.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 12 21:03:18 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 1rD8yM-000A4e-75 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 12 Dec 2023 21:03:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rD8xu-00058M-Mw; Tue, 12 Dec 2023 15:02:50 -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 1rD8xq-00056t-FS for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 15:02: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 1rD8xq-0000GN-6O for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 15:02:46 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rD8y5-0007NZ-N0 for bug-gnu-emacs@gnu.org; Tue, 12 Dec 2023 15:03:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 12 Dec 2023 20:03: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.170241136828337 (code B ref 66117); Tue, 12 Dec 2023 20:03:01 +0000 Original-Received: (at 66117) by debbugs.gnu.org; 12 Dec 2023 20:02:48 +0000 Original-Received: from localhost ([127.0.0.1]:57627 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rD8xs-0007Mz-1K for submit@debbugs.gnu.org; Tue, 12 Dec 2023 15:02:48 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:36266) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rD8xq-0007Mn-Rf for 66117@debbugs.gnu.org; Tue, 12 Dec 2023 15:02:47 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id BDFBD80157; Tue, 12 Dec 2023 15:02:25 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1702411344; bh=CiCZMaaFSBNRtRLKDs8zliZLjfgCXqHTrvZbhRw2Kzo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ReFExQsXVLZx6lWby6tIr511tP+lqVKR4i9+abvT03j/31k6N2R3tEBdQkO03RH1k Pc0tjG2uww4ej7oVRtevXOpt6KMlU4m1uO6j4Hoj1A9vmLUPtsesFgZl2DO8OcG4QD fmz+0R7fgB6Xo+Pg+Z6+/EhJU9S0+KfbubIrk8JkI5sMMHbEWA4z6c6+1E75WMU+WT 7Ce9gI9v9jS3rDnFTELXMKsNc0Z2osU72EG2STwjmXtUBvBJ4NZcCmzjLb5Q4Fe32I ctI3igxkgFBRYp//bd55YA0BE/vhCSuwSpN0iJZImNF+DLW4LgrX8IgJQVfwcC48ar DjZPQbBPSvJNA== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C8A5C80357; Tue, 12 Dec 2023 15:02:24 -0500 (EST) Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B75121202BD; Tue, 12 Dec 2023 15:02:24 -0500 (EST) In-Reply-To: <87plzbxtxa.fsf@localhost> (Ihor Radchenko's message of "Tue, 12 Dec 2023 16:33:05 +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:276077 Archived-At: > - What I propose is to avoid this loop in `do_specbind' altogether. > Instead of having to loop through all the buffers to set temporary > buffer-local value, I propose to introduce special buffer object > `buffer_overrides' that will hold such temporary bindings. > Then, we can change BVAR to something like > > #define BVAR(buf, field) (buffer_overrides->field ## _ == UNSET ?\ > (buf)->field ## _ :\ > buffer_overrides->field ## _) If we're willing to pay the cost of such a test, then we don't need a new `buffer_overrides`, we can just set `buf->field` to a special value (e.g. `Qunbound`, tho we'll probably need to use a new similar special value) and then do: #define BVAR(buf, field) ((buf)->field ## _ != Qunbound ?\ (buf)->field ## _ :\ buffer_defaults->field ## _) This said, in the case of `case-fold-search` I think there's a simpler solution: make it "buffer-local only", meaning that let-binding it affects only the current buffer (rather than affecting all the buffers which have not made it buffer-local yet). Stefan