[webkit-dev] Time to remove LIKELY and UNLIKELY macros?

Ryosuke Niwa rniwa at webkit.org
Tue Oct 2 00:48:24 PDT 2012


On Tue, Oct 2, 2012 at 12:17 AM, Mike Lawther <mikelawther at google.com>wrote:

>
> On 2 October 2012 16:29, Maciej Stachowiak <mjs at apple.com> wrote:
>
>>
>> Note, despite the stackoverflow thread cited, I would be highly surprised
>> if static branch predicition had no effect ever, even on modern
>> architectures. While recent intel CPUs have very good dynamic branch
>> prediction, the basic block reordering should still have a significant
>> impact in some cases due to cache effects.
>>
>> Aside: interestingly, the Core2 family of CPUs doesn't do 'static branch
> prediction' in the traditional sense. When they encounter a branch not
> already in the BTB, a BTB index is assigned to it. The prediction now
> proceeds as though it were dynamic - meaning that this first time, it
> predicts based on the previous data in that index. That is, it's
> effectively a 50% chance of taken/not taken the first time the branch is
> encountered (source: http://www.agner.org/optimize/microarchitecture.pdf,
> Section 3.15).
>

Strange. I still observed ~10% performance gain from adding LIKELY/UNLIKELY
on Westmere.

- Ryosuke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20121002/680c9316/attachment.html>


More information about the webkit-dev mailing list