improved delta adding speed i think (todo: run more safety tests on insert_exact)

legacy
Avril 4 years ago
parent 53e9230aa7
commit e6f979942d
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -79,12 +79,14 @@ impl Delta
} else if span.len() == 1 { } else if span.len() == 1 {
inserter.insert(self.location, span[0]); inserter.insert(self.location, span[0]);
} else if span.len() > 1 { } else if span.len() > 1 {
// reserve the extra space inserter.insert_exact(self.location, span.iter().copied());
/*// reserve the extra space
inserter.reserve(span.len()); inserter.reserve(span.len());
// shift everything across, replacing with the new values // shift everything across, replacing with the new values
let splice: Vec<_> = inserter.splice(self.location.., span.iter().cloned()).collect(); let splice: Vec<_> = inserter.splice(self.location.., span.iter().cloned()).collect();
// add tail back // add tail back
inserter.extend(splice); inserter.extend(splice);*/
} }
}, },
_ => unimplemented!(), _ => unimplemented!(),

Loading…
Cancel
Save