Skip to content

Commit

Permalink
Add two inline annotations for hot functions
Browse files Browse the repository at this point in the history
These two functions are essentially no-ops (and compile to just a load and
return), but show up in process_obligations profiles with a high call count --
so worthwhile to try and inline them away.
  • Loading branch information
Mark-Simulacrum committed Oct 3, 2021
1 parent 2801a77 commit 1c2ad79
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_infer/src/infer/type_variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ pub(crate) struct TyVidEqKey<'tcx> {
}

impl<'tcx> From<ty::TyVid> for TyVidEqKey<'tcx> {
#[inline] // make this function eligible for inlining - it is quite hot.
fn from(vid: ty::TyVid) -> Self {
TyVidEqKey { vid, phantom: PhantomData }
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_type_ir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ impl EqUnifyValue for IntVarValue {}

impl UnifyKey for IntVid {
type Value = Option<IntVarValue>;
#[inline] // make this function eligible for inlining - it is quite hot.
fn index(&self) -> u32 {
self.index
}
Expand Down

0 comments on commit 1c2ad79

Please sign in to comment.