Closed
Bug 236753
Opened 21 years ago
Closed 21 years ago
use __builtin_expect to provide branch prediction hints
Categories
(SeaMonkey :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: bryner, Assigned: bryner)
Details
Attachments
(2 files)
1.62 KB,
patch
|
dbaron
:
review+
dbaron
:
superreview+
|
Details | Diff | Splinter Review |
758 bytes,
patch
|
dbaron
:
review+
dbaron
:
superreview+
|
Details | Diff | Splinter Review |
We should use gcc's __builtin_expect() to provide branch prediction hints to the
compiler. I'd propose adding macros NS_LIKELY and NS_UNLIKELY that wrap the
expression to be tested and give the expected value as 1 and 0 respectively.
And a good place to make use of this would be NS_SUCCEEDED and NS_FAILED. We
should expect success.
Assignee | ||
Comment 1•21 years ago
|
||
Assignee | ||
Updated•21 years ago
|
Attachment #143229 -
Flags: superreview?(dbaron)
Attachment #143229 -
Flags: review?(dbaron)
Comment on attachment 143229 [details] [diff] [review]
patch
r+sr=dbaron, but feel free to drop the outer set of parentheses on the
definitions of NS_FAILED and NS_SUCCEEDED.
Attachment #143229 -
Flags: superreview?(dbaron)
Attachment #143229 -
Flags: superreview+
Attachment #143229 -
Flags: review?(dbaron)
Attachment #143229 -
Flags: review+
Comment on attachment 143229 [details] [diff] [review]
patch
Also, your definitions of NS_LIKELY and NS_UNLIKELY should parenthesize the x
inside the macro.
(And you actually should be ok without the outer paretheses in the definitions
of NS_LIKELY and NS_UNLIKELY as well -- for the gcc3 definitions -- which is
what the previous comment was referring to as well.)
Assignee | ||
Comment 5•21 years ago
|
||
checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 6•21 years ago
|
||
mark NS_ENSURE_TRUE's test as unlikely. The only concern I have with this is
that you will get two __builtin_expect()s with NS_ENSURE_SUCCESS:
if (__builtin_expect(__builtin_expect(!(rv & 0x80000000), 0), 0))
but I don't think this causes a problem.
Assignee | ||
Updated•21 years ago
|
Attachment #143250 -
Flags: superreview?(dbaron)
Attachment #143250 -
Flags: review?(dbaron)
Attachment #143250 -
Flags: superreview?(dbaron)
Attachment #143250 -
Flags: superreview+
Attachment #143250 -
Flags: review?(dbaron)
Attachment #143250 -
Flags: review+
Updated•20 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•