How does one get likely()
and unlikely()
on stable?
This post has a snippet from hashbrown
, but looking in the latest hashbrown sources this no longer seems to be the case -- instead there's this:
// Branch prediction hint. This is currently only available on nightly but it
// consistently improves performance by 10-15%.
#[cfg(not(feature = "nightly"))]
use core::convert::identity as likely;
#[cfg(not(feature = "nightly"))]
use core::convert::identity as unlikely;
#[cfg(feature = "nightly")]
use core::intrinsics::{likely, unlikely};
How should this be interpreted? There's currently no way to get useful hinting in stable?