Skip to content

Code Quality: Optimize the code logic for loading the file list #15831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix: Optimize the code logic for loading the file list
There's no need to perform reordering every time some files are loaded, because the interval between each reordering is 500ms, which is too short for users to see the sorted results before it's reordered again. This means that during the file loading process, the sorting results are useless to users, and it also causes a lot of extra CPU computational overhead, leading to lag in the file loading process. It's sufficient to perform a single sorting of all files only after the file list has finished loading completely.

Signed-off-by: Tptogiar <Tptogiar@gmail.com>
  • Loading branch information
Tptogiar committed Jul 21, 2024
commit 5ee2a4af6f6724fed610547b8dc9bea464b323b3
1 change: 0 additions & 1 deletion src/Files.App/ViewModels/ShellViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,6 @@ await Task.Run(async () =>
List<ListedItem> fileList = await Win32StorageEnumerator.ListEntries(path, hFile, findData, cancellationToken, -1, intermediateAction: async (intermediateList) =>
{
filesAndFolders.AddRange(intermediateList);
await OrderFilesAndFoldersAsync();
await ApplyFilesAndFoldersChangesAsync();
});

Expand Down