perf: cache and sort microphone inputs once instead of every frame (#27)

In `draw_footer`, the `all_inputs` HashMap was being collected into a Vec
and sorted on every single UI frame (~60 FPS). This caused unnecessary
overhead and allocations.

This commit introduces a cached `all_inputs_sorted` vector in the
`AudioPlayerState` which is populated only when the inputs map changes
during the state sync. `draw_footer` now loops over this pre-sorted
vector directly.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
This commit is contained in:
Tarasov Aleksandr
2026-03-08 00:28:45 +03:00
committed by GitHub
parent 968eba80e6
commit 077518019f
3 changed files with 15 additions and 5 deletions
+1
View File
@@ -55,6 +55,7 @@ pub struct AudioPlayerState {
pub current_input: String,
pub all_inputs: HashMap<String, String>,
pub all_inputs_sorted: Vec<(String, String)>,
pub is_daemon_running: bool,
}