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.devel Subject: Re: [PATCH v2 00/16] Speeding up DEFVAR_PER_BUFFER Date: Tue, 01 Dec 2020 17:10:56 +0200 Message-ID: <83r1o9imtb.fsf@gnu.org> References: <20201119153814.17541-1-sbaugh@catern.com> <837dqdxtea.fsf@gnu.org> <87a6v9jqz8.fsf@catern.com> <83y2itwbzk.fsf@gnu.org> <87ft4shxg8.fsf@catern.com> <835z5mk84w.fsf@gnu.org> <87y2iihafg.fsf@catern.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23165"; mail-complaints-to="usenet@ciao.gmane.io" Cc: arnold@tdrhq.com, dgutov@yandex.ru, monnier@iro.umontreal.ca, rms@gnu.org, emacs-devel@gnu.org To: Spencer Baugh Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 01 16:12:02 2020 Return-path: Envelope-to: ged-emacs-devel@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 1kk7Jx-0005ss-Fr for ged-emacs-devel@m.gmane-mx.org; Tue, 01 Dec 2020 16:12:01 +0100 Original-Received: from localhost ([::1]:37236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kk7Jw-00067Y-Gq for ged-emacs-devel@m.gmane-mx.org; Tue, 01 Dec 2020 10:12:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58626) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kk7JC-0004sF-NU for emacs-devel@gnu.org; Tue, 01 Dec 2020 10:11:14 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55957) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kk7JB-0000Xq-Lu; Tue, 01 Dec 2020 10:11:13 -0500 Original-Received: from [176.228.60.248] (port=3346 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kk7Iz-0006w7-Hh; Tue, 01 Dec 2020 10:11:02 -0500 In-Reply-To: <87y2iihafg.fsf@catern.com> (message from Spencer Baugh on Mon, 30 Nov 2020 15:11:31 -0500) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:260122 Archived-At: > From: Spencer Baugh > Cc: emacs-devel@gnu.org, arnold@tdrhq.com, monnier@iro.umontreal.ca, > dgutov@yandex.ru, rms@gnu.org > Date: Mon, 30 Nov 2020 15:11:31 -0500 > > > But OTOH, referencing buffer-local values through BVAR is now slower, > > about twice slower, I guess? For example, the display code has 90 > > uses of BVAR, and they will now be slower. I wonder what that means > > for us: we are making let-binding of local variables much faster, but > > "punish" the code that just accesses these variables in our inner > > loops. > > Yes, it's probably a trade-off. In fact, the current code is slow only when the buffer that's current at the moment of the let-binding doesn't have a buffer-local value for the variable. Because if the current buffer does have a local value, the let-binding simply changes that single local value. So in effect we make every access to built-in buffer-local variables pay for the single use case when the let-binding is done in a buffer that has no local value. I'm not sure how to assess this kind of trade-off. > My guess is that the extra overhead of BVAR will not be significant, > but benchmarking is the only way to know for sure. We should benchmark, but coming up with suitable use cases to make these measurements is not easy.