don't iterate over all impls when none match

before:
573.01user 4.04system 7:33.86elapsed 127%CPU (0avgtext+0avgdata 1141656maxresident)k
after:
567.03user 4.00system 7:28.23elapsed 127%CPU (0avgtext+0avgdata 1133112maxresident)k

an additional 1% improvement
This commit is contained in:
Ariel Ben-Yehuda 2015-08-18 00:17:02 +03:00
parent 8aeaaac654
commit 13809ffff7

View file

@ -3222,13 +3222,12 @@ impl<'tcx> TraitDef<'tcx> {
for &impl_def_id in impls {
f(impl_def_id);
}
return; // we don't need to process the other non-blanket impls
}
}
for v in self.nonblanket_impls.borrow().values() {
for &impl_def_id in v {
f(impl_def_id);
} else {
for v in self.nonblanket_impls.borrow().values() {
for &impl_def_id in v {
f(impl_def_id);
}
}
}
}