-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Attempt to improve performance of beatmap carousel when not grouped by sets #35398
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| using osu.Framework.Graphics.Shapes; | ||
| using osu.Framework.Graphics.UserInterface; | ||
| using osu.Framework.Localisation; | ||
| using osu.Framework.Threading; | ||
| using osu.Game.Beatmaps; | ||
| using osu.Game.Beatmaps.Drawables; | ||
| using osu.Game.Graphics; | ||
|
|
@@ -55,6 +56,7 @@ public partial class PanelBeatmapStandalone : Panel | |
| private CancellationTokenSource? starDifficultyCancellationSource; | ||
|
|
||
| private PanelSetBackground beatmapBackground = null!; | ||
| private ScheduledDelegate? scheduledBackgroundRetrieval; | ||
|
|
||
| private OsuSpriteText titleText = null!; | ||
| private OsuSpriteText artistText = null!; | ||
|
|
@@ -222,7 +224,7 @@ protected override void PrepareForUse() | |
|
|
||
| var beatmapSet = beatmap.BeatmapSet!; | ||
|
|
||
| beatmapBackground.Beatmap = beatmaps.GetWorkingBeatmap(beatmap); | ||
| scheduledBackgroundRetrieval = Scheduler.AddDelayed(b => beatmapBackground.Beatmap = beatmaps.GetWorkingBeatmap(b), beatmap, 50); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember testing this during original implementation but I couldn't see the overhead. I may have been incorrectly testing though, as working beatmaps do get cached after first load. (And I guess that's one thing to note here – this is delayed the load even when they are cached already. Shouldn't change anything since you've just moved the delay from elsewhere, though.) |
||
|
|
||
| titleText.Text = new RomanisableString(beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title); | ||
| artistText.Text = new RomanisableString(beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist); | ||
|
|
@@ -244,6 +246,8 @@ protected override void FreeAfterUse() | |
| { | ||
| base.FreeAfterUse(); | ||
|
|
||
| scheduledBackgroundRetrieval?.Cancel(); | ||
| scheduledBackgroundRetrieval = null; | ||
| beatmapBackground.Beatmap = null; | ||
| updateButton.BeatmapSet = null; | ||
| localRank.Beatmap = null; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit awkward but worth it for the huge performance boost.