Auto merge of #77755 - bugadani:perf-calc-dtor, r=ecstatic-morse
Monomorphize `calculate_dtor` instead of using function pointers Change `calculate_dtor` to avoid dynamic dispatching. This change allows the empty functions to be optimized away. Based on the discussion in https://github.com/rust-lang/rust/pull/77754#discussion_r502498970, the performance impact of this change was measured. Perf run results: https://perf.rust-lang.org/compare.html?start=7bc5839e99411aad9061a632b62075d1346cbb3b&end=ffec759ae9bbc4d6d2235ff40ade6723a85bc7cc
This commit is contained in:
commit
2d6eccdb67
4 changed files with 4 additions and 4 deletions
|
@ -53,7 +53,7 @@ impl<'a, 'tcx> ConstMutationChecker<'a, 'tcx> {
|
|||
//
|
||||
// #[const_mutation_allowed]
|
||||
// pub const LOG: Log = Log { msg: "" };
|
||||
match self.tcx.calculate_dtor(def_id, &mut |_, _| Ok(())) {
|
||||
match self.tcx.calculate_dtor(def_id, |_, _| Ok(())) {
|
||||
Some(_) => None,
|
||||
None => Some(def_id),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue