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

ANDROID: Make SAF lookup faster #4761

wants to merge 2 commits into from


Copy link

This fixes slowness at startup when there are many games.
The getChild was called once for each folder and while iterating over many entries, it only cached the result it was interested in.
getChild now calls getChildren when an entry is not in cache. This caches the whole folder and speeds up look ups for the same folder.
The cache is increased to take into account folder with more than 1000 elements (now 10000).
Currently, if a folder has more than 10000 items, elements could be seen as not found.

This caches all files in the directory once and looks up at the cache
This is still slow when the file doesn't exist.
Handling this case is quite complicated because we need to take into
account the cache eviction.
Copy link

@antoniou79 antoniou79 left a comment

Choose a reason for hiding this comment

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

Looks good.
I haven't checked the alternative PR yet.

Copy link
Member Author

#4762 has been favoured over this one.

@lephilousophe lephilousophe deleted the android-fast-saf branch March 4, 2023 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
2 participants