Run a single huge par_body_owners instead of many small ones after each other.

This improves parallel rustc parallelism by avoiding the bottleneck after each individual `par_body_owners` (because it needs to wait for queries to finish, so if there is one long running one, a lot of cores will be idle while waiting for the single query).
This commit is contained in:
Oli Scherer 2024-03-07 14:23:52 +00:00
parent e2e751e76d
commit 55ea94402b
24 changed files with 265 additions and 275 deletions

View file

@ -191,19 +191,6 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
// Freeze definitions as we don't add new ones at this point. This improves performance by
// allowing lock-free access to them.
tcx.untracked().definitions.freeze();
// FIXME: Remove this when we implement creating `DefId`s
// for anon constants during their parents' typeck.
// Typeck all body owners in parallel will produce queries
// cycle errors because it may typeck on anon constants directly.
tcx.hir().par_body_owners(|item_def_id| {
let def_kind = tcx.def_kind(item_def_id);
if !matches!(def_kind, DefKind::AnonConst) {
tcx.ensure().typeck(item_def_id);
}
});
tcx.ensure().check_unused_traits(());
}
/// A quasi-deprecated helper used in rustdoc and clippy to get