perf: throttle malloc_trim + avoid VecDeque clones (squashed)

Squash of 2 yoda commits:
- 77262dd0 perf(malloc): throttle malloc_trim to 1 Hz in hot paths
- 1d98eee6 perf(widget): avoid VecDeque clone in segmented_button/table Model::clear
This commit is contained in:
Lionel DARNIS 2026-05-25 13:01:53 +02:00
parent 8fa6a01d04
commit ea17ada931
3 changed files with 39 additions and 5 deletions

View file

@ -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);
}
}