From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: master b0ba0d42b0f: * src/lisp.h (EQ): Improve generated code. Date: Thu, 28 Nov 2024 13:53:40 +0000 Message-ID: References: <173279015204.1017853.4020802222494409378@vcs3.savannah.gnu.org> <20241128103552.86CC34F4FDB@vcs3.savannah.gnu.org> Reply-To: Pip Cet Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4676"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Emacs Devel To: Andrea Corallo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 28 15:30:56 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 1tGfXk-00012p-3B for ged-emacs-devel@m.gmane-mx.org; Thu, 28 Nov 2024 15:30:56 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGfX5-0007xw-Q5; Thu, 28 Nov 2024 09:30:16 -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 1tGexp-0000f2-6g for emacs-devel@gnu.org; Thu, 28 Nov 2024 08:53:50 -0500 Original-Received: from mail-40131.protonmail.ch ([185.70.40.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGexm-0006ti-W8 for emacs-devel@gnu.org; Thu, 28 Nov 2024 08:53:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1732802024; x=1733061224; bh=tCfVyOnWSP0hJGPuMruDiU180bS/Ht/iYD7Lz9SjIKk=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=snRys/g1oIvUBe8KBeiBU81WF3V76rgPz6LaRi6KQmxJVyIXLm2LY0ZRquVydHeNx SBdt8HLQiTKc3BxDdsi50qODmF3cvKIOE8VJdxxprdsVX0fhb3XF+Ju8q9M0w4jUQY B0/RNkQEyT0o4zc6GQMcgEplvBfMFGaVk6zAKadfjZ6uwTcACB43pswR5laZ1vX4T2 HXa7bfeqRWlowYFM4arluHPj9a7SEei/U3j7fAvtp09uveCKZNzskluxhkb4avweLx CMIt/KUjKy2I9OAQly0Rfq1q909SEwy/aGk12I7jIrxmaUORRX7gkhOAJ6Vf4aEU/8 udJL2NmEpXvJw== In-Reply-To: <20241128103552.86CC34F4FDB@vcs3.savannah.gnu.org> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 2b544cdd5c536daaed5cbd857924094f9c7eba41 Received-SPF: pass client-ip=185.70.40.131; envelope-from=pipcet@protonmail.com; helo=mail-40131.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 28 Nov 2024 09:29:44 -0500 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:325817 Archived-At: On Thursday, November 28th, 2024 at 10:35, Andrea Corallo wrote: > branch: master > commit b0ba0d42b0fdf70a20cd7a070128db8abe4a0826 > Author: Andrea Corallo acorallo@gnu.org >=20 > Commit: Andrea Corallo acorallo@gnu.org >=20 >=20 > * src/lisp.h (EQ): Improve generated code. >=20 > Outside compilation 'symbols_with_pos_enabled' is always false, so ask > the compiler to organize the most likely execution path in a sequential > fashion in order to favor run-time performance. Are we officially using __builtin_expect now? I think that's a major change to the way Emacs C code is written, and a dec= ision which might benefit from further discussion. To quote the GCC manual: In general, you should prefer to use actual profile feedback for this (-fpr= ofile-arcs), as programmers are notoriously bad at predicting how their pro= grams actually perform. Maybe we should use __builtin_expect_with_probability instead, in those rar= e cases when we are certain we're making a correct prediction? Or, my prefe= rence, avoid using __builtin_expect entirely, so our scarce resources can b= e spent on more important issues? I also don't think the assumption you're telling GCC to make in this specif= ic case (more than 90% of calls to EQ happen while syms_with_pos_enabled = =3D=3D false) is obviously correct. IIUC, the current master branch won't even compile with a compiler that doe= sn't handle (or ignore) __builtin_expect. Pip