##// END OF EJS Templates
rust-discovery: optimization of add commons/missings for empty arguments...
Georges Racinet on percheron.racinet.fr -
r42971:c5748c69 default
parent child Browse files
Show More
@@ -225,7 +225,11 b' impl<G: Graph + Clone> PartialDiscovery<'
225 &mut self,
225 &mut self,
226 common: impl IntoIterator<Item = Revision>,
226 common: impl IntoIterator<Item = Revision>,
227 ) -> Result<(), GraphError> {
227 ) -> Result<(), GraphError> {
228 let before_len = self.common.get_bases().len();
228 self.common.add_bases(common);
229 self.common.add_bases(common);
230 if self.common.get_bases().len() == before_len {
231 return Ok(());
232 }
229 if let Some(ref mut undecided) = self.undecided {
233 if let Some(ref mut undecided) = self.undecided {
230 self.common.remove_ancestors_from(undecided)?;
234 self.common.remove_ancestors_from(undecided)?;
231 }
235 }
@@ -246,11 +250,14 b' impl<G: Graph + Clone> PartialDiscovery<'
246 &mut self,
250 &mut self,
247 missing: impl IntoIterator<Item = Revision>,
251 missing: impl IntoIterator<Item = Revision>,
248 ) -> Result<(), GraphError> {
252 ) -> Result<(), GraphError> {
253 let mut tovisit: VecDeque<Revision> = missing.into_iter().collect();
254 if tovisit.is_empty() {
255 return Ok(());
256 }
249 self.ensure_children_cache()?;
257 self.ensure_children_cache()?;
250 self.ensure_undecided()?; // for safety of possible future refactors
258 self.ensure_undecided()?; // for safety of possible future refactors
251 let children = self.children_cache.as_ref().unwrap();
259 let children = self.children_cache.as_ref().unwrap();
252 let mut seen: HashSet<Revision> = HashSet::new();
260 let mut seen: HashSet<Revision> = HashSet::new();
253 let mut tovisit: VecDeque<Revision> = missing.into_iter().collect();
254 let undecided_mut = self.undecided.as_mut().unwrap();
261 let undecided_mut = self.undecided.as_mut().unwrap();
255 while let Some(rev) = tovisit.pop_front() {
262 while let Some(rev) = tovisit.pop_front() {
256 if !self.missing.insert(rev) {
263 if !self.missing.insert(rev) {
General Comments 0
You need to be logged in to leave comments. Login now