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


Reply via email to