*index = other_index.max(*index);
}
});
-
- self.0.append(&mut other.0);
+ // We use `extend` instead of `BTreeMap::append` due to performance issues with `append`.
+ // Refer to https://github.com/rust-lang/rust/issues/34666#issuecomment-675658420
+ self.0.extend(other.0);
}
/// Returns whether the changeset are empty.
}
impl<K: Ord, V> Append for BTreeMap<K, V> {
- fn append(&mut self, mut other: Self) {
- BTreeMap::append(self, &mut other)
+ fn append(&mut self, other: Self) {
+ // We use `extend` instead of `BTreeMap::append` due to performance issues with `append`.
+ // Refer to https://github.com/rust-lang/rust/issues/34666#issuecomment-675658420
+ BTreeMap::extend(self, other)
}
fn is_empty(&self) -> bool {
}
impl<T: Ord> Append for BTreeSet<T> {
- fn append(&mut self, mut other: Self) {
- BTreeSet::append(self, &mut other)
+ fn append(&mut self, other: Self) {
+ // We use `extend` instead of `BTreeMap::append` due to performance issues with `append`.
+ // Refer to https://github.com/rust-lang/rust/issues/34666#issuecomment-675658420
+ BTreeSet::extend(self, other)
}
fn is_empty(&self) -> bool {
}
impl<A: Ord> Append for ChangeSet<A> {
- fn append(&mut self, mut other: Self) {
- self.txs.append(&mut other.txs);
- self.txouts.append(&mut other.txouts);
- self.anchors.append(&mut other.anchors);
+ fn append(&mut self, other: Self) {
+ // We use `extend` instead of `BTreeMap::append` due to performance issues with `append`.
+ // Refer to https://github.com/rust-lang/rust/issues/34666#issuecomment-675658420
+ self.txs.extend(other.txs);
+ self.txouts.extend(other.txouts);
+ self.anchors.extend(other.anchors);
// last_seen timestamps should only increase
self.last_seen.extend(