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: master 8c81818673a 6/7: Tune volatile in read_char Date: Mon, 19 Aug 2024 22:27:21 +0300 Message-ID: <86ttfgwbxi.fsf@gnu.org> References: <172386820621.30556.15409337288904485218@vcs2.savannah.gnu.org> <20240817041648.A6687C2BC66@vcs2.savannah.gnu.org> <87f24fac-aa71-499f-a398-2bad70a0ca42@cs.ucla.edu> <8634n0y2th.fsf@gnu.org> <87plq4cyuj.fsf@protonmail.com> <861q2ky0tg.fsf@gnu.org> <87le0scxig.fsf@protonmail.com> <86y14swksj.fsf@gnu.org> <71607435-31fd-4a6c-8392-ad5725c8f3b3@cs.ucla.edu> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4351"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pipcet@protonmail.com, acorallo@gnu.org, emacs-devel@gnu.org, stefankangas@gmail.com To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 19 21:27:58 2024 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 1sg82n-0000xd-Ew for ged-emacs-devel@m.gmane-mx.org; Mon, 19 Aug 2024 21:27:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sg82a-0008Hj-TV; Mon, 19 Aug 2024 15:27:44 -0400 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 1sg82Y-0008HG-ED for emacs-devel@gnu.org; Mon, 19 Aug 2024 15:27:42 -0400 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 1sg82X-0007YG-9b; Mon, 19 Aug 2024 15:27:41 -0400 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=i5xwt5xwQz7uDnMo7AiyJH/0tE1y7t3zJWaob8Llees=; b=fNwyeBIxcluW sKArWb3MS8m6NUPvagDtujmyVOiiySCRrfqhWu0/twdyUucugOTxSRKEitYm5biPZHvySJBahxq8N arPSgXnoGQ0eT+NohAb7jn15rnyJHO4lMImYz0ZfGG/s4PtC/unG0YazQjWbU1V9SUIZ/je1o/nmV 0vmNYjuQvWJSd55V6lM2D1k7US7KRMzrkYIaVs3iWbaAVKBAKJkOyqeAWf4qumz+6xSChpLl7tKGq yrkQQJ4ynMkywYWHOv/Sa4kC714P4We9rKRaqcalBW+FNE5vZNbh9tVqD4wLh/8C4e8ML0kwvEfEw xoVYJA+86DEutkk9+YAoIw==; In-Reply-To: <71607435-31fd-4a6c-8392-ad5725c8f3b3@cs.ucla.edu> (message from Paul Eggert on Mon, 19 Aug 2024 11:59:28 -0700) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:322942 Archived-At: > Date: Mon, 19 Aug 2024 11:59:28 -0700 > Cc: acorallo@gnu.org, emacs-devel@gnu.org, stefankangas@gmail.com > From: Paul Eggert > > On 2024-08-19 09:15, Eli Zaretskii wrote: > > Why not simply undo that single patch, and be done? > > Let's not. The issue has long been present and is not limited to > read_char; see, for example, the variable "this_op" in exec_byte_code, > which is merely a volatile copy of "op". The method Emacs uses to > address this issue works and there's no reason to use a different method > in read_char than everywhere else. I'm talking only about that particular change, whose motivation is described as "Optimize access to a local volatile." If this is just an optimization, and its effect on performance is as you describe it, but it has a downside of making the code harder to read and maintain, why not pay that small penalty in performance? > A better way to deal with 'volatile' is to not use it, the way Stefan > did in 2013; see commit adf2aa61404305e58e71cde0193bb650aff2c4b3. I have nothing against 'volatile' in general. Once again, this is only about the "optimization" part of your changes.