hint: Add a recommendation to benchmark with cold_path
Other hints have a note recommending benchmarks to ensure they actually do what is intended. This is also applicable for `cold_path`, so add a note here.
This commit is contained in:
parent
d222ddc4d9
commit
74e70765ad
1 changed files with 4 additions and 0 deletions
|
|
@ -708,6 +708,10 @@ pub const fn unlikely(b: bool) -> bool {
|
|||
/// Hints to the compiler that given path is cold, i.e., unlikely to be taken. The compiler may
|
||||
/// choose to optimize paths that are not cold at the expense of paths that are cold.
|
||||
///
|
||||
/// Note that like all hints, the exact effect to codegen is not guaranteed. Using `cold_path`
|
||||
/// can actually *decrease* performance if the branch is called more than expected. It is advisable
|
||||
/// to perform benchmarks to tell if this function is useful.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue