I agree. That's why I propose to only use it - if we do use it for
anything - for singletons, where it should be a no-brainer.
On 10/13/10, Henrik Nordström <henrik_at_henriknordstrom.net> wrote:
> tis 2010-10-12 klockan 17:47 +0200 skrev Kinkie:
>> Hi all,
>> this patch-let makes implements a GCC feature to hint the branch
>> prediction algorithms about the likely outcome of a test. This is useful
>> to optimize the case of singleton patterns (e.g.
>> CacheManager::GetInstance).
>> This implements the likely() and unlikely() macros.
>
> My experience is that unless one is very careful the use of these hints
> often backfire after the code evolves a bit.
>
> The compiler is generally pretty good at doing the right choice, and the
> runtime profiling support can be used to fill in the missing spots
> automatically, with no risk of decaying over time.
>
> Yes, a profiling based build requires a bit of effort in each build, as
> it requires you to first make a profiling build an put some reasonable
> workload on it and then build again providing the profiling data as
> input to the compiler.
>
> Regards
> Henrik
>
>
>
-- /kinkieReceived on Wed Oct 13 2010 - 18:50:26 MDT
This archive was generated by hypermail 2.2.0 : Thu Oct 14 2010 - 12:00:04 MDT