Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Issue 114933002: [POSSIBLE PERFORMANCE IMPACT] Use __builtin_expect on Clang as well (for UNLIKELY and LIKELY) (Closed)

Created:
7 years ago by Nils Barth (inactive)
Modified:
7 years ago
CC:
blink-reviews, yurys+blink_chromium.org, loislo+blink_chromium.org, adamk+blink_chromium.org, Jeffrey Yasskin, tonyg
Visibility:
Public.

Description

[POSSIBLE PERFORMANCE IMPACT] Use __builtin_expect on Clang as well (for UNLIKELY and LIKELY) OOPS: Nop, since COMPILER(CLANG) => COMPILER(GCC) Fixed gratuitous test in: Remove redundant test: COMPILER(GCC) || COMPILER(CLANG) => COMPILER(GCC) https://codereview.chromium.org/105673006/ ==================================================== Original description Performance impact: Likely has minor positive effect on Mac (uses Clang). UNLIKELY and LIKELY use __builtin_expect, which provides some performance benefit (not a lot, but every bit helps). This compiler directive is supported on Clang, not only GCC, so this turns it on in Clang. (This is the only use of __builtin_expect in Blink.) (Suggested by Kouhei.) Docs: http://llvm.org/docs/BranchWeightMetadata.html#builtin-expect http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -2 lines) Patch
M Source/wtf/Compiler.h View 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
Nils Barth (inactive)
Hi Adam and Eric, Kouhei recently observed that __builtin_expect is supported in Clang, not just ...
7 years ago (2013-12-13 02:37:22 UTC) #1
eseidel
Fine by me, but this is really a C++ ninja (thakis/jyasskin) or perf-team question. I ...
7 years ago (2013-12-13 03:06:10 UTC) #2
eseidel
lgtm
7 years ago (2013-12-13 03:06:31 UTC) #3
kouhei (in TOK)
lgtm
7 years ago (2013-12-13 03:10:20 UTC) #4
haraken
I don't think this is a right fix. I think #if defined(GCC) implies #if defined(CLANG). ...
7 years ago (2013-12-13 03:12:12 UTC) #5
haraken
On 2013/12/13 03:12:12, haraken wrote: > I don't think this is a right fix. > ...
7 years ago (2013-12-13 03:12:42 UTC) #6
Nils Barth (inactive)
On 2013/12/13 03:12:12, haraken wrote: > I don't think this is a right fix. > ...
7 years ago (2013-12-13 03:41:45 UTC) #7
Nico
not lgtm COMPILER(GCC) is true for clang. this is a noop cl
7 years ago (2013-12-13 04:47:43 UTC) #8
Nico
Oh, haraken said that already. He's right :-)
7 years ago (2013-12-13 04:48:16 UTC) #9
Nils Barth (inactive)
On 2013/12/13 04:47:43, Nico wrote: > not lgtm > > COMPILER(GCC) is true for clang. ...
7 years ago (2013-12-13 04:57:56 UTC) #10
Chris Evans
7 years ago (2013-12-13 06:29:13 UTC) #11
Message was sent while issue was closed.
On 2013/12/13 04:47:43, Nico wrote:
> not lgtm
> 
> COMPILER(GCC) is true for clang. this is a noop cl

Hehe. A few months back, I made this mistake and also posted a no-op CL along
the same lines, also caught by Nico. ;-)

Powered by Google App Engine
This is Rietveld 408576698