Skip to content
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

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

Merged
merged 1 commit into from
Jul 21, 2024

Conversation

Tptogiar
Copy link
Contributor

Resolved / Related Issues

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.

Steps used to test these changes

Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.

  1. Create a new folder on the disk
  2. Use a script to generate 100,000 small files inside this folder
  3. Exit the folder, then re-enter the folder
  4. Compare the file loading speed

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 <[email protected]>
Copy link
Member

@hishitetsu hishitetsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your opinion is reasonable. If we can allow not sorting until all files are loaded, this PR is worth merging.

@Josh65-2201
Copy link
Member

Josh65-2201 commented Jul 21, 2024

I would say this should be merged for the performance improvements. My testing shows loading a 43 thousand items folder on preview 3.5.10 takes 170+ seconds and this 15 seconds.

@yaira2 yaira2 changed the title Fix: Optimize the code logic for loading the file list Code Quality: Optimize the code logic for loading the file list Jul 21, 2024
@yaira2 yaira2 added ready to merge Pull requests that are approved and ready to merge and removed needs - code review labels Jul 21, 2024
@yaira2 yaira2 merged commit f7cac70 into files-community:main Jul 21, 2024
6 checks passed
@0x5bfa
Copy link
Member

0x5bfa commented Jul 21, 2024

preview 3.5.10 takes 170+ seconds and this 15 seconds.

@Tptogiar Thank you!

@yaira2
Copy link
Member

yaira2 commented Jul 21, 2024

@Tptogiar this issue and your pull request showcase the benefit of open-source. By identifying and addressing the issue, you have not only enhanced your own experience but also contributed to the overall improvement of Files for the entire userbase!

@Tptogiar
Copy link
Contributor Author

Tptogiar commented Aug 2, 2024

Hello @yaira2 , I would like to ask you some questions about this project:

How do you usually speed up project compilation? On my virtual machine, every time I modify the code and recompile, it takes about 30-50 seconds. Here are the hardware configurations of my virtual machine. What configuration options in Visual Studio can be adjusted to speed up the compilation?
CPU:

QEMU Virtual CPU version 2.5+
Base Speed: 2.10 GHz
Slots: 1
Virtual Processors: 8
Virtual Machine: Yes
Does this project have any integration with automated testing? On which platform is it integrated, and is there any relevant documentation?
Could you please let me know your email address, or you can send an email to me at [email protected].

@yaira2
Copy link
Member

yaira2 commented Aug 2, 2024

How do you usually speed up project compilation? On my virtual machine, every time I modify the code and recompile, it takes about 30-50 seconds. Here are the hardware configurations of my virtual machine. What configuration options in Visual Studio can be adjusted to speed up the compilation?

It depends on the specs but 30 seconds is pretty decent. For UI changes you can often take advantage of hot reload to avoid recompiling for every change.

Does this project have any integration with automated testing? On which platform is it integrated, and is there any relevant documentation?

We have some basic testing for accessibility as well as some simple file operations. Docs are here https://github.com/files-community/Files/blob/main/.github/CONTRIBUTING.md#running-interaction-tests-optional.

@yaira2
Copy link
Member

yaira2 commented Aug 2, 2024

In case you weren't aware, we have a Discord server and you're welcome to join https://discord.gg/files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull requests that are approved and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants