Make DefIdForest cheaper to clone
Since `DefIdForest` contains 0 or 1 elements the large majority of the time, by allocating only in the >1 case we avoid almost all allocations, compared to `Arc<SmallVec<[DefId;1]>>`. This shaves off 0.2% on the benchmark that stresses uninhabitedness checking.
This commit is contained in:
@@ -1314,7 +1314,7 @@ rustc_queries! {
|
||||
/// check whether the forest is empty.
|
||||
query type_uninhabited_from(
|
||||
key: ty::ParamEnvAnd<'tcx, Ty<'tcx>>
|
||||
) -> Arc<ty::inhabitedness::DefIdForest> {
|
||||
) -> ty::inhabitedness::DefIdForest {
|
||||
desc { "computing the inhabitedness of `{:?}`", key }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user