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

Reduce IO primarily during save operations #16190

Merged
merged 10 commits into from
Oct 9, 2022

Conversation

unknownbrackets
Copy link
Collaborator

This reduces cases of GetFileListing or OpenFile combined with GetFileInfo, reduces duplicate file open/close cycles, and avoids some loads that weren't necessary.

This is just intended to improve the performance penalty of scoped storage on Android when dealing with save data.

-[Unknown]

Copy link
Owner

@hrydgard hrydgard left a comment

Choose a reason for hiding this comment

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

Very very nice, thanks!

Comment on lines +1804 to +1805
// TODO: Why do we add this padding? Crash avoidance?
fileData.resize(fileData.size() + 0x01000000);
Copy link
Owner

Choose a reason for hiding this comment

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

This looks dubious and a bit excessive indeed. Would prefer to remove...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, it's 16 MB. Been there for a long time it seems. I guess I can just remove, I'd kinda rather do that separately in case something I did here breaks save data or causes crashes.

-[Unknown]

Copy link
Owner

Choose a reason for hiding this comment

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

Agreed.

Let's always use ReadEntireFile() when we can.
These can take time so let's try to bundle them.
We often won't need this, so skip the call until needed.
Improves startup for games that load sceFont on devices with slow storage.
Sometimes, you need to tell the difference between an empty directory and
one that doesn't exist at all.  We can do this in a single call.
We can skip if there's no UI.
This only caches between touching PSP code, in case something changes.
Reduces cases of multiple SFO lookups and reads.
@unknownbrackets unknownbrackets added this to the v1.14.0 milestone Oct 9, 2022
@hrydgard hrydgard merged commit bc9215c into hrydgard:master Oct 9, 2022
@unknownbrackets unknownbrackets deleted the save-slow branch October 9, 2022 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants