From 04c3efd01aee4edc2e36a0bdb0d0ad123e2096e4 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 26 Jan 2022 14:44:10 +0100 Subject: [PATCH] Minor optimization: avoid reallocating set of visible ID:s --- egui/src/memory.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/egui/src/memory.rs b/egui/src/memory.rs index 4afdfeb8..c367d205 100644 --- a/egui/src/memory.rs +++ b/egui/src/memory.rs @@ -568,7 +568,8 @@ impl Areas { .. } = self; - *visible_last_frame = std::mem::take(visible_current_frame); + std::mem::swap(visible_last_frame, visible_current_frame); + visible_current_frame.clear(); order.sort_by_key(|layer| (layer.order, wants_to_be_on_top.contains(layer))); wants_to_be_on_top.clear(); }