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: Reduce gameFileCache lock contention #10054

Merged
merged 3 commits into from Aug 27, 2021

Conversation

JosJuice
Copy link
Member

This fixes a performance issue where if you tried to view the details of a game while a game list scan was ongoing, Dolphin would freeze until the game list scan finished.

FindAllGamePaths may take a little while, and holding the
gameFileCache lock isn't actually necessary until it's time to
put the results returned by FindAllGamePaths into gameFileCache.

The downside of this change is that we have to do an extra
round of JNI in between FindAllGamePaths and Update,
but I don't think that's much of a problem.
It seems like we spend a lot of the game list scanning time in
updateAdditionalMetadata, which I suppose makes sense considering
how many different files that function attempts to open.

With the addition of just one little atomic operation, we can make
it safe to call updateAdditionalMetadata without holding a lock.
This path isn't really any faster in the normal case,
but it does let us skip waiting for the lock to be available,
which makes a huge difference if the lock is already taken.
@lioncash lioncash merged commit 4816195 into dolphin-emu:master Aug 27, 2021
11 checks passed
@JosJuice JosJuice deleted the android-game-cache-lock branch August 27, 2021 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants