diff --git a/osu.Game/Scoring/ScorePerformanceManager.cs b/osu.Game/Scoring/ScorePerformanceManager.cs index d8daf7189a..b7657c73c6 100644 --- a/osu.Game/Scoring/ScorePerformanceManager.cs +++ b/osu.Game/Scoring/ScorePerformanceManager.cs @@ -26,19 +26,14 @@ public class ScorePerformanceManager : Component /// An optional to cancel the operation. public async Task CalculatePerformanceAsync([NotNull] ScoreInfo score, CancellationToken token = default) { - if (tryGetExisting(score, out var perf, out var lookupKey)) - return perf; + var lookupKey = new PerformanceCacheLookup(score); + + if (performanceCache.TryGetValue(lookupKey, out double performance)) + return performance; return await computePerformanceAsync(score, lookupKey, token); } - private bool tryGetExisting(ScoreInfo score, out double performance, out PerformanceCacheLookup lookupKey) - { - lookupKey = new PerformanceCacheLookup(score); - - return performanceCache.TryGetValue(lookupKey, out performance); - } - private async Task computePerformanceAsync(ScoreInfo score, PerformanceCacheLookup lookupKey, CancellationToken token = default) { var attributes = await difficultyManager.GetDifficultyAsync(score.Beatmap, score.Ruleset, score.Mods, token);