Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
Scaevolus
on May 6, 2021
|
parent
|
context
|
favorite
| on:
Branch predictor: How many “if”s are too many?
Given appropriate likeliness annotations or profile-guided optimization, it's possible for the compiler to _invert_ the conditional and move the log statement to a "cold" section of code outside of the main flow, making it a never-taken branch.
lttlrck
on May 6, 2021
[–]
Yes. I guess that's covered by "it's probably ok"... I'm going to play in godbolt now.
Scaevolus
on May 6, 2021
|
parent
[–]
-O2 turns it into a "jump if nonzero" without any extra annotations:
https://www.godbolt.org/z/j9dfrbosv
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: