From 31a83eae4d9f0aff6e7d506ea98f18896c442cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Sun, 9 Sep 2018 13:40:37 +0200 Subject: [PATCH] feat: Break the groups loops when limit is reached --- raptor/src/rank/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/raptor/src/rank/mod.rs b/raptor/src/rank/mod.rs index bfe49dc9e..8b3ef1302 100644 --- a/raptor/src/rank/mod.rs +++ b/raptor/src/rank/mod.rs @@ -71,12 +71,12 @@ fn matches_into_iter(matches: FnvHashMap>, limit: usize) let temp = mem::replace(&mut groups, Vec::new()); let mut computed = 0; - for group in temp { + 'grp: for group in temp { group.sort_unstable_by(sort); for group in GroupByMut::new(group, |a, b| sort(a, b) == Ordering::Equal) { computed += group.len(); groups.push(group); - if computed >= limit { break } + if computed >= limit { break 'grp } } } }