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" <bug-gnu-emacs@gnu.org>
Newsgroups: gmane.emacs.bugs
Subject: bug#66117: 30.0.50;
 `find-buffer-visiting' is slow when opening large number of buffers
Date: Thu, 14 Dec 2023 13:41:59 -0500
Message-ID: <jwvsf44aawg.fsf-monnier+emacs@gnu.org>
References: <878r919qfh.fsf@localhost> <87plzbxtxa.fsf@localhost>
 <jwv8r5zgppw.fsf-monnier+emacs@gnu.org>
 <bc19f481-311a-b171-8097-3bca2135aff1@gutov.dev>
 <jwvr0jrf292.fsf-monnier+emacs@gnu.org> <87y1dzvvf0.fsf@localhost>
 <a5b1c7c9-0422-6994-165c-0d1ca5bf4334@gutov.dev>
 <jwvttomdaiu.fsf-monnier+emacs@gnu.org> <83plzas3pg.fsf@gnu.org>
 <87r0jqw8u9.fsf@localhost> <83jzpis08a.fsf@gnu.org>
 <87il52w744.fsf@localhost> <83fs06rz10.fsf@gnu.org>
 <87fs06w4ui.fsf@localhost> <83bkaurut9.fsf@gnu.org>
 <87o7esq319.fsf@localhost> <83bkasrb3f.fsf@gnu.org>
 <jwvwmtgg1fj.fsf-monnier+emacs@gnu.org> <83wmtgpuyf.fsf@gnu.org>
 <jwvy1dwacbu.fsf-monnier+emacs@gnu.org> <871qboprh3.fsf@localhost>
Reply-To: Stefan Monnier <monnier@iro.umontreal.ca>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214";
	logging-data="23842"; mail-complaints-to="usenet@ciao.gmane.io"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cc: dmitry@gutov.dev, Eli Zaretskii <eliz@gnu.org>, mattias.engdegard@gmail.com,
 66117@debbugs.gnu.org
To: Ihor Radchenko <yantar92@posteo.net>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 14 19:43:27 2023
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>
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 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org>)
	id 1rDqgA-00060N-TT
	for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 14 Dec 2023 19:43:27 +0100
Original-Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces@gnu.org>)
	id 1rDqfo-0008K2-Bu; Thu, 14 Dec 2023 13:43:04 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1rDqfm-0008JY-Pp
 for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2023 13:43:02 -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 <Debian-debbugs@debbugs.gnu.org>)
 id 1rDqfm-00013D-Hd
 for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2023 13:43:02 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1rDqfl-0000Iq-TF
 for bug-gnu-emacs@gnu.org; Thu, 14 Dec 2023 13:43:01 -0500
X-Loop: help-debbugs@gnu.org
Resent-From: Stefan Monnier <monnier@iro.umontreal.ca>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Thu, 14 Dec 2023 18:43:01 +0000
Resent-Message-ID: <handler.66117.B66117.17025793291087@debbugs.gnu.org>
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.17025793291087
 (code B ref 66117); Thu, 14 Dec 2023 18:43:01 +0000
Original-Received: (at 66117) by debbugs.gnu.org; 14 Dec 2023 18:42:09 +0000
Original-Received: from localhost ([127.0.0.1]:50918 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1rDqeu-0000HT-QH
 for submit@debbugs.gnu.org; Thu, 14 Dec 2023 13:42:09 -0500
Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:51295)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@iro.umontreal.ca>) id 1rDqet-0000HE-Gl
 for 66117@debbugs.gnu.org; Thu, 14 Dec 2023 13:42:07 -0500
Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 3EA08441994;
 Thu, 14 Dec 2023 13:42:02 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1702579320;
 bh=sSo8eFgittNCwNB9Q7uXo8NnMt2xwadBd8KYTtYBbCU=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=ZH4DYPGR/qgQA2pjdqI1ke5LFqVmR73ULyq3mvoGdo5Rlu0StKBxSMefPFzAOllOw
 7wMsRbDffxg7Jnl8fAiEP8MpkKV75VkkrflZ9MScao94q4rstx0cCCx4fGCxE8kC07
 tlruAbufHMUfbHbWZubKA2jL8dfboqlZbJZe+Ei/LrM4I6KxY2Z1LWJVUrye95KkF6
 h22YVVgLcfPR6EkOyhhjmfBlG0eOxMJs9AggZPhHx40krQii9fa6VVP043y5M423zE
 YLPRGQvs+SqINCvThIYXAKamqzS2bAuHjqsQMyrxk4jVyX+7GbXLGUBh6RcWqrF1a0
 I5OJwXZjEsnCA==
Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id E4A7F44197D;
 Thu, 14 Dec 2023 13:42:00 -0500 (EST)
Original-Received: from pastel (69-196-162-59.dsl.teksavvy.com [69.196.162.59])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6A85E120B3E;
 Thu, 14 Dec 2023 13:42:00 -0500 (EST)
In-Reply-To: <871qboprh3.fsf@localhost> (Ihor Radchenko's message of "Thu, 14
 Dec 2023 18:30:00 +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" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=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:276206
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/276206>

>>> It won't be buffer-local-if-changed, so binding it will not be costly.
>> As mentioned elsewhere in this bug-report we can make `case-fold-search`
>> into a `DEFVAR_LISP`: it would have no visible impact to ELisp and would
>> avoid the costly let-bindings.
> Wouldn't DEFVAR_LISP break major modes that do (setq case-fold-search ...)?

No, it makes no difference to Lisp.  It only changes the implementation
strategy: DEFVAR_LISP stores the value in a global C variable (which
thus requires more processing when the var is buffer-local, more
specifically updating the C var when we `set-buffer`), whereas
DEFVAR_PER_BUFFER stores the value inside the buffer object (which
thus requires more processing when the var is *not* buffer-local since
the global value is duplicated in all the buffers where it's not made
buffer-local).

DEFVAR_PER_BUFFER are thus the better option for vars which are set
buffer-locally in most buffers whereas DEFVAR_LISP is the better option
for vars which are made buffer-local only in a few buffers.


        Stefan