[Top][All Lists]

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

Re: Using __builtin_expect (likely/unlikely macros)

From: Stefan Monnier
Subject: Re: Using __builtin_expect (likely/unlikely macros)
Date: Tue, 16 Apr 2019 17:27:24 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> Which again shows a slight improvement with the Cold attributes, and
> still shows the hot attributes degrading performance.  Perhaps I was too
> overzealous with the hot tagging?

I think it's pretty tricky to decide which functions should be "hot", so
I'm not surprised you get worse results there: That matches the past
experience with programmer-annotated likelihood ;-)

For "cold" I think the meaning is pretty clear: assume this code is
almost never executed which can both mean that functions that call it
can be optimized under the assumption that those calls are unlikely, and
at the same time spend less time optimizing the function (and move it
"out of the way" to a different page).

But for "hot", it's not clear whether it means "called very often" or
"we spend a lot of time inside of it".  E.g. it would never have
occurred to me to mark  redisplay_internal as "hot".


reply via email to

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