libcosmic-yoda/src/widget/table/model
Lionel DARNIS 1d98eee6de perf(widget): avoid VecDeque clone in segmented_button/table Model::clear
Model::clear() cloned the entire order VecDeque to iterate while
remove() mutated it, producing an O(n) allocation proportional to the
number of items — needless on a clear() which is going to drop all of
them anyway.

Replace the clone with std::mem::take(&mut self.order): we iterate the
taken VecDeque (transferring ownership), and the inner self.order.remove(index)
in each remove() call now finds position()==None and no-ops, since
self.order has been swapped with an empty default.

Same semantics, zero allocation. Noticeable on large nav/table models
(>100 items) and on apps that reset state frequently (settings pages,
file lists, context menus).
2026-04-19 16:29:02 +02:00
..
category.rs feat(widget): add table widget 2025-03-24 17:48:20 +01:00
entity.rs chore(table): format code 2025-03-26 16:42:50 +01:00
mod.rs perf(widget): avoid VecDeque clone in segmented_button/table Model::clear 2026-04-19 16:29:02 +02:00
selection.rs chore(table): format code 2025-03-26 16:42:50 +01:00