From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Andy Moreton Newsgroups: gmane.emacs.devel Subject: Re: Using __builtin_expect (likely/unlikely macros) Date: Thu, 18 Apr 2019 14:47:37 +0100 Message-ID: References: <87a7gst973.fsf@gmail.com> <875zrgt12q.fsf@gmail.com> <6919a4c8-df76-ea1e-34db-1fa62a360e5a@cs.ucla.edu> <87h8aykdod.fsf@gmail.com> <4fa7885e-8c66-c7c4-ff71-a013505863af@cs.ucla.edu> <2dfb837d-989d-c736-b6e6-b20c0e940596@cs.ucla.edu> <87o956c4n4.fsf@gmail.com> <1fbd2fca-18f0-0a90-7a45-58419a9e11ee@cs.ucla.edu> <1555450070.23658.4@yandex.ru> <66b74701-012a-902e-4a5b-6bc30efa87c0@cs.ucla.edu> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="97815"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 18 16:00:22 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hH7aQ-000PGe-Ae for ged-emacs-devel@m.gmane.org; Thu, 18 Apr 2019 16:00:22 +0200 Original-Received: from localhost ([127.0.0.1]:41837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hH7aP-0002Wb-DW for ged-emacs-devel@m.gmane.org; Thu, 18 Apr 2019 10:00:21 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51981) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hH7ZP-0001mr-Oj for emacs-devel@gnu.org; Thu, 18 Apr 2019 09:59:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hH7OH-0003T1-T2 for emacs-devel@gnu.org; Thu, 18 Apr 2019 09:47:50 -0400 Original-Received: from [195.159.176.226] (port=54418 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hH7OH-0003Re-LM for emacs-devel@gnu.org; Thu, 18 Apr 2019 09:47:49 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.89) (envelope-from ) id 1hH7OD-000An8-It for emacs-devel@gnu.org; Thu, 18 Apr 2019 15:47:45 +0200 X-Injected-Via-Gmane: http://gmane.org/ Cancel-Lock: sha1:hVs8mbIR/O+f5LkoCA/Zc3hsOo8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 195.159.176.226 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:235618 Archived-At: On Thu 18 Apr 2019, Paul Eggert wrote: > Konstantin Kharlamov wrote: >> I was told that e.g. "cold" attribute can sometimes produce unbearably slow >> code https://gcc.gnu.org/ml/gcc-help/2019-01/msg00035.html > > Although cold functions can be slow, it appears that overall it's a win for > Emacs to mark _Noreturn error function declarations as cold: on my platform, > 'make compile-always' ran about 1.3% faster. So I installed the attached patch > into master. (Like Stefan, I'm wary of marking functions 'hot' so I didn't do > that.) > > This patch also adds a convenience macro AVOID for the now-common pattern > '_Noreturn ATTRIBUTE_COLD void'. Please don't use this macro, as it makes the code much less readable. It is reasonable to have a macro that combines the '_Noreturn' and 'ATTRIBUTE_COLD' decorations, but that should not be combined with the return type. AndyM