perf: use sort_by_cached_key to avoid repeated lowercase allocations in file sorting

This commit is contained in:
Christian Visintin
2026-02-27 22:31:59 +01:00
parent 97a2240cf7
commit dc767236f5

View File

@@ -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