From b2f2894aa1f988e3b5591de7bd5f6693d1c78443 Mon Sep 17 00:00:00 2001 From: Tarasov Aleksandr <55220741+arabianq@users.noreply.github.com> Date: Fri, 1 May 2026 01:48:43 +0300 Subject: [PATCH] perf(gui): remove O(N) allocation in hotkeys table render (#94) This optimization removes an unnecessary `.cloned()` call inside `draw_hotkeys_table` which previously forced a clone of every filtered `HotkeySlot` on every frame render. Instead, we now hold a `Vec<&HotkeySlot>` and only clone `slot.slot` exactly when a user interaction requires ownership to dispatch a `HotkeyAction`. This eliminates constant heap allocations of `String` and `Request` components while scrolling or idling in the hotkeys view. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> --- src/gui/draw.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/draw.rs b/src/gui/draw.rs index 11ed8c9..11a0e12 100644 --- a/src/gui/draw.rs +++ b/src/gui/draw.rs @@ -231,7 +231,6 @@ impl SoundpadGui { .to_lowercase() .contains(&search) }) - .cloned() .collect(); let available_width = ui.available_width();