perf: throttle malloc_trim + avoid VecDeque clones (squashed)
Squash of 2 yoda commits: -77262dd0perf(malloc): throttle malloc_trim to 1 Hz in hot paths -1d98eee6perf(widget): avoid VecDeque clone in segmented_button/table Model::clear
This commit is contained in:
parent
8fa6a01d04
commit
ea17ada931
3 changed files with 39 additions and 5 deletions
|
|
@ -98,7 +98,10 @@ where
|
|||
/// model.clear();
|
||||
/// ```
|
||||
pub fn clear(&mut self) {
|
||||
for entity in self.order.clone() {
|
||||
// `remove()` mutates `self.order`, so transfer ownership first:
|
||||
// the inner `self.order.remove(index)` then no-ops because
|
||||
// `position()` can't find the entity in the empty VecDeque.
|
||||
for entity in std::mem::take(&mut self.order) {
|
||||
self.remove(entity);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue