D5942: rust: less set lookups in AncestorsIterator
gracinet (Georges Racinet)
phabricator at mercurial-scm.org
Sat Feb 16 03:34:40 UTC 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG70827ebba453: rust: less set lookups in AncestorsIterator (authored by gracinet, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D5942?vs=14039&id=14124
REVISION DETAIL
https://phab.mercurial-scm.org/D5942
AFFECTED FILES
rust/hg-core/src/ancestors.rs
CHANGE DETAILS
diff --git a/rust/hg-core/src/ancestors.rs b/rust/hg-core/src/ancestors.rs
--- a/rust/hg-core/src/ancestors.rs
+++ b/rust/hg-core/src/ancestors.rs
@@ -79,8 +79,7 @@
#[inline]
fn conditionally_push_rev(&mut self, rev: Revision) {
- if self.stoprev <= rev && !self.seen.contains(&rev) {
- self.seen.insert(rev);
+ if self.stoprev <= rev && self.seen.insert(rev) {
self.visit.push(rev);
}
}
@@ -154,11 +153,10 @@
Ok(ps) => ps,
Err(e) => return Some(Err(e)),
};
- if p1 < self.stoprev || self.seen.contains(&p1) {
+ if p1 < self.stoprev || !self.seen.insert(p1) {
self.visit.pop();
} else {
*(self.visit.peek_mut().unwrap()) = p1;
- self.seen.insert(p1);
};
self.conditionally_push_rev(p2);
To: gracinet, #hg-reviewers
Cc: durin42, kevincox, mercurial-devel
More information about the Mercurial-devel
mailing list