Skip to content

Commit 13809ff

Browse files
author
Ariel Ben-Yehuda
committed
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
1 parent 8aeaaac commit 13809ff

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/librustc/middle/ty.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -3222,13 +3222,12 @@ impl<'tcx> TraitDef<'tcx> {
32223222
for &impl_def_id in impls {
32233223
f(impl_def_id);
32243224
}
3225-
return; // we don't need to process the other non-blanket impls
32263225
}
3227-
}
3228-
3229-
for v in self.nonblanket_impls.borrow().values() {
3230-
for &impl_def_id in v {
3231-
f(impl_def_id);
3226+
} else {
3227+
for v in self.nonblanket_impls.borrow().values() {
3228+
for &impl_def_id in v {
3229+
f(impl_def_id);
3230+
}
32323231
}
32333232
}
32343233
}

0 commit comments

Comments
 (0)