Skip to content

Commit

Permalink
don't iterate over all impls when none match
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Ariel Ben-Yehuda committed Aug 17, 2015
1 parent 8aeaaac commit 13809ff
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/librustc/middle/ty.rs
Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit 13809ff

Please sign in to comment.