Improve perf measurements of `build_extern_trait_impl`

Before, it was only measuring one callsite of `build_impl`, and it
incremented the call count even if `build_impl` returned early because
the `did` was already inlined.

Now, it measures all calls, minus calls that return early.
This commit is contained in:
Noah Lev 2021-10-27 20:06:48 -07:00
parent 4e0d3973fa
commit eb713d272c
2 changed files with 3 additions and 3 deletions

View File

@ -335,6 +335,8 @@ crate fn build_impl(
return;
}
let _prof_timer = cx.tcx.sess.prof.generic_activity("build_extern_trait_impl");
let tcx = cx.tcx;
let associated_trait = tcx.impl_trait_ref(did);

View File

@ -31,9 +31,7 @@ crate fn collect_trait_impls(krate: Crate, cx: &mut DocContext<'_>) -> Crate {
for &cnum in cx.tcx.crates(()).iter() {
for &(did, _) in cx.tcx.all_trait_implementations(cnum).iter() {
cx.tcx.sess.prof.generic_activity("build_extern_trait_impl").run(|| {
inline::build_impl(cx, None, did, None, &mut new_items);
});
inline::build_impl(cx, None, did, None, &mut new_items);
}
}