mirror of
https://github.com/veeso/termscp.git
synced 2026-09-12 15:16:01 -07:00
perf: use sort_by_cached_key to avoid repeated lowercase allocations in file sorting
This commit is contained in:
+2
-1
@@ -245,7 +245,8 @@ impl FileExplorer {
|
|||||||
|
|
||||||
/// Sort explorer files by their name. All names are converted to lowercase
|
/// Sort explorer files by their name. All names are converted to lowercase
|
||||||
fn sort_files_by_name(&mut self) {
|
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
|
/// Sort files by mtime; the newest comes first
|
||||||
|
|||||||
Reference in New Issue
Block a user