[Top][All Lists]

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

Re: Using __builtin_expect (likely/unlikely macros)

From: Paul Eggert
Subject: Re: Using __builtin_expect (likely/unlikely macros)
Date: Sat, 20 Apr 2019 11:58:36 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

Óscar Fuentes wrote:
For improvements where the
generated code is "obviously" faster (fewer and simpler instructions,
say), I typically don't bother with measurements as my own time is
limited too.
You will be surprised.

Modern hardware is complex.

I'm often surprised :-), but I don't expect to be surprised when the generated code seems obviously faster to me. Although I'm not as expert as the computer architecture researcher whose office sits next to mine, I know how modern hardware works reasonably well and regularly give lectures on topics like μops and TLBs so I won't be surprised as often as a naive programmer might be.
If the 1.3% improvement in performance requires non-minimal source code
complexity growth

It doesn't. In this case the source code shrank slightly. Only very slightly: just by 0.001% (this counts all files under Git control). Still, a win's a win.

reply via email to

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