On Jan 31, 12:04 pm, Chris Peterson <[email protected]> wrote:
> On 1/31/13 11:21 AM, L. David Baron wrote:
>
> >> On Thu, Jan 31, 2013 at 1:31 PM, L. David Baron <[email protected]> wrote:
> >>> Is it possible we might be able to make MOZ_LIKELY and MOZ_UNLIKELY
> >>> meaningful on Windows (they currently only do anything on gcc or
> >>> clang builds)?  If we did, might that get back some of the gain from
> >>> turning off PGO?
>
> Patrick McManus benchmarked the benefit of gcc's likely/unlikely macros
> on the Linux kernel (where they are very commonly used). He found _no_
> measurable differences after redefining likely/unlikely to nops.
>
> Patrick ran his tests in 2008, so perhaps the results would different
> with a recent version of gcc. I would also be interested is seeing test
> results when reversing the macros' definitions (#define likely <->
> unlikely). :)
>
> http://bitsup.blogspot.com/2008/04/measuring-performance-of-linux-ker...

Drive-by comment: likely/unlikely is of course highly architecture
dependent. On PowerPC, for example, these may change the way the
likely bit is set on the branch, which is used as part of branch
prediction. On that and similar architectures, likely/unlikely can
significantly improve the performance of branchy code. I've started
writing this into TenFourFox in certain places. On cross-platform code
like the Linux kernel, I would hazard to say it makes quite a
difference across the spectrum.

But even where this feature doesn't exist (post-Netburst x86, most
ARM), it is my understanding that it will still cause code generation
to "favour" the likely branch such as making it more likely to stay in
the I-cache, etc.

Cameron Kaiser
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to