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
|
@ -341,7 +341,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
pub fn calculate_dtor(
|
||||
self,
|
||||
adt_did: DefId,
|
||||
validate: &mut dyn FnMut(Self, DefId) -> Result<(), ErrorReported>,
|
||||
validate: impl Fn(Self, DefId) -> Result<(), ErrorReported>,
|
||||
) -> Option<ty::Destructor> {
|
||||
let drop_trait = self.lang_items().drop_trait()?;
|
||||
self.ensure().coherent_trait(drop_trait);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue