emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using __builtin_expect (likely/unlikely macros)


From: Andy Moreton
Subject: Re: Using __builtin_expect (likely/unlikely macros)
Date: Thu, 18 Apr 2019 14:47:37 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]