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

eliminate second call to expensive query #861

Merged
merged 2 commits into from Dec 4, 2021

Conversation

Jamiras
Copy link
Member

@Jamiras Jamiras commented Nov 27, 2021

The query used to determine the latest masters of a set and highest scorers for a set is very intensive when a set has a lot of users as it has to calculate every user's score for the set and the datetime of the last achievement earned by the user from the set.

The current implementation runs the query twice, once for High Scores, and once for Latest Masters. This PR runs it once to determine both.

In my dev env, this eliminated 25% of the time spent generating the game page for Super Mario Bros. (6.6s down from 8.8s), which has 5186 unique users for which those values had to be calculated.

I'm not sure if this will translate directly to the live site. The live Super Mario Bros. set has over 17k users, and Super Mario World has over 27k users. Both of these pages took me more than 15 seconds to load. Even shaving 4 seconds (~25%) off those times would be beneficial.

lib/database/game.php Show resolved Hide resolved
@Jamiras Jamiras merged commit b55cab6 into RetroAchievements:master Dec 4, 2021
@Jamiras Jamiras deleted the perf_top_achievers branch December 4, 2021 16:50
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