Skip to content

Android: Make SAF slightly faster by getting rid of DocumentFile#2985

Merged
2 commits merged into
EasyRPG:masterfrom
Ghabry:android/saf
May 31, 2023
Merged

Android: Make SAF slightly faster by getting rid of DocumentFile#2985
2 commits merged into
EasyRPG:masterfrom
Ghabry:android/saf

Conversation

@Ghabry

@Ghabry Ghabry commented May 4, 2023

Copy link
Copy Markdown
Member

…in the native code wrapper

Also do not query anything when the entire goal is to open a file descriptor.

This should make opening of files for reading slightly faster as the DocumentFile roundtrip is gone.

However in my tests it doesn't feel faster. There are still awful lagspikes when a new file is being opened m(


This also could break stuff so have fun sharing and testing ;).

@Ghabry Ghabry added Android Performance Related to improvements on memory, less CPU or disk usage, battery savings, etc. labels May 4, 2023
@Ghabry Ghabry added this to the 0.8.1 milestone May 4, 2023
String documentId = DocumentsContract.getTreeDocumentId(rootUri);
if (DocumentsContract.isDocumentUri(context, rootUri)) {
documentId = DocumentsContract.getDocumentId(rootUri);
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

no idea why this is needed. I copied this from the DocumentFile constructor. When its missing it doesn't work 🤷

@Ghabry Ghabry modified the milestones: 0.8.1, 0.8.0.1 May 12, 2023
@Ghabry

Ghabry commented May 15, 2023

Copy link
Copy Markdown
Member Author

Looking for some testers here: Please install the APK and test if games still work (in ZIP and extracted).

Also curious about the "feeling" if it is for you the same performance or slower/faster (also try measuring the game load time).

@Ghabry

Ghabry commented May 16, 2023

Copy link
Copy Markdown
Member Author

No idea why but this breaks custom SF when the game is not inside a zip

Ghabry added 2 commits May 25, 2023 15:43
…he native code wrapper

Also do not query anything when the entire goal is to open a file descriptor.
@Ghabry Ghabry marked this pull request as ready for review May 25, 2023 13:49
@Ghabry

Ghabry commented May 25, 2023

Copy link
Copy Markdown
Member Author

I think this works now. The problem here was that SAF transforms invalid URIs to a root URI (extremely stupid). Then opening this root URI gives a valid file descriptor to a directory.

I detect this case now...

@ghost ghost merged commit 00fe629 into EasyRPG:master May 31, 2023
@Ghabry Ghabry deleted the android/saf branch June 12, 2023 18:07
sevenc-nanashi pushed a commit to sevenc-nanashi/easyrpg-player that referenced this pull request May 31, 2026
Android: Make SAF slightly faster by getting rid of DocumentFile
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Android Performance Related to improvements on memory, less CPU or disk usage, battery savings, etc.

Development

Successfully merging this pull request may close these issues.

1 participant