perf: refactor to reduce memory allocations and cpu work

This commit is contained in:
Cheong Lau 2025-10-05 16:36:59 +10:00 • committed by Michael Murphy
parent 0c3e3c8629
commit dd0158d8f0
24 changed files with 234 additions and 242 deletions

View file

@ -173,7 +173,7 @@ impl cosmic::Application for Minimize {
// Temporarily take ownership to appease the borrow checker.
let mut apps = std::mem::take(&mut self.apps);
if let Some(pos) = apps.iter_mut().position(|a| {
if let Some(pos) = apps.iter().position(|a| {
a.toplevel_info.foreign_toplevel == toplevel_info.foreign_toplevel
}) {
if apps[pos].toplevel_info.app_id != toplevel_info.app_id {
@ -194,7 +194,7 @@ impl cosmic::Application for Minimize {
name: desktop_entry
.full_name(&self.locales)
.unwrap_or(Cow::Borrowed(&desktop_entry.appid))
.to_string(),
.into_owned(),
icon_source: fde::IconSource::from_unknown(
desktop_entry.icon().unwrap_or(&desktop_entry.appid),
),