From dc767236f54773ebc1357c072d892874118d8eab Mon Sep 17 00:00:00 2001 From: Christian Visintin Date: Fri, 27 Feb 2026 22:31:59 +0100 Subject: [PATCH] perf: use sort_by_cached_key to avoid repeated lowercase allocations in file sorting --- src/explorer/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/explorer/mod.rs b/src/explorer/mod.rs index 31d29ee..1d6bee5 100644 --- a/src/explorer/mod.rs +++ b/src/explorer/mod.rs @@ -245,7 +245,8 @@ impl FileExplorer { /// Sort explorer files by their name. All names are converted to lowercase fn sort_files_by_name(&mut self) { - self.files.sort_by_key(|x: &File| x.name().to_lowercase()); + self.files + .sort_by_cached_key(|x: &File| x.name().to_lowercase()); } /// Sort files by mtime; the newest comes first