Small speed improvement
This commit is contained in:
parent
648fa58d3d
commit
623ed241d6
|
@ -112,17 +112,9 @@ impl Index {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert(&mut self, v: CachedAssertion) -> Events {
|
pub fn insert(&mut self, outer_value: CachedAssertion) -> Events {
|
||||||
self.adjust(v, 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn remove(&mut self, v: CachedAssertion) -> Events {
|
|
||||||
self.adjust(v, -1)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn adjust(&mut self, outer_value: CachedAssertion, delta: bag::Count) -> Events {
|
|
||||||
let mut outputs = Vec::new();
|
let mut outputs = Vec::new();
|
||||||
let net = self.all_assertions.change(outer_value.clone(), delta);
|
let net = self.all_assertions.change(outer_value.clone(), 1);
|
||||||
match net {
|
match net {
|
||||||
bag::Net::AbsentToPresent => {
|
bag::Net::AbsentToPresent => {
|
||||||
Modification::new(
|
Modification::new(
|
||||||
|
@ -137,6 +129,16 @@ impl Index {
|
||||||
})
|
})
|
||||||
.perform(&mut self.root);
|
.perform(&mut self.root);
|
||||||
}
|
}
|
||||||
|
bag::Net::PresentToPresent => (),
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
|
outputs
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn remove(&mut self, outer_value: CachedAssertion) -> Events {
|
||||||
|
let mut outputs = Vec::new();
|
||||||
|
let net = self.all_assertions.change(outer_value.clone(), -1);
|
||||||
|
match net {
|
||||||
bag::Net::PresentToAbsent => {
|
bag::Net::PresentToAbsent => {
|
||||||
Modification::new(
|
Modification::new(
|
||||||
false,
|
false,
|
||||||
|
@ -150,7 +152,8 @@ impl Index {
|
||||||
})
|
})
|
||||||
.perform(&mut self.root);
|
.perform(&mut self.root);
|
||||||
}
|
}
|
||||||
_ => ()
|
bag::Net::PresentToPresent => (),
|
||||||
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
outputs
|
outputs
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue