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

Show count of beatmaps in collections in manage dialog #22932

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

peppy
Copy link
Member

@peppy peppy commented Mar 22, 2023

Touched on in #22930

osu! 2023-03-22 at 05 47 27

Colour = colours.Yellow
});

itemCountSubscription = realm.SubscribeToPropertyChanged(r => r.Find<BeatmapCollection>(collection.ID), c => c.BeatmapMD5Hashes, _ =>
Copy link
Collaborator

@bdach bdach Apr 3, 2023

Choose a reason for hiding this comment

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

This is instant alarm bells for me. One subscription for each item on the list? So potentially N subscriptions for N items? There's no pooling or list virtualisation anywhere here, so that means one subscription for every collection in db. The collections dialog is also registered at OsuGame level, which means that the disposal of the subscription isn't going to save us any as it just doesn't fire until the game is closed.

I fear this is going to fall over badly for power users with monstrous beatmap collections.

  • Do we need this to be a subscription, even? The manage collections dialog is modal. There's not really any way for the counts to change while it's open except for background imports - but maybe it's fine not to support that?
  • If we do need this to be a subscription, it should probably be handled a lot more economically. Maybe by eagerly acquiring on show and eagerly disposing on hide. Or by pooling/DLUW.

Copy link
Member Author

Choose a reason for hiding this comment

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

It should be pretty efficient with realm/realm-dotnet#3121, which is why I went for this.

I'd be more interested in moving it once we see it having an adverse effect. And definitely not by pooling (maybe one subscription at the dialog level, although that may have higher overhead due to no keypath filtering).

Do we need this to be a subscription, even? The manage collections dialog is modal. There's not really any way for the counts to change while it's open except for background imports - but maybe it's fine not to support that?

It's modal, but unless the counts are refreshed each time it's shown, there's plenty of other ways the counts can change (right click menu at song select; collections dropdown at song select).

Copy link
Member

Choose a reason for hiding this comment

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

Is the supposed performance concern still blocking this? I thought the flow was pushing stuff until someone complained.

Copy link
Collaborator

@bdach bdach Feb 28, 2024

Choose a reason for hiding this comment

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

I'm not merging without testing. Someone linked a database with a bunch of huge collections so I might give this a try using that and see how hard it dies.

I thought the flow was pushing stuff until someone complained.

This is not how I operate. If there's a clear concern at review time I don't see why we would "push it anyway". That would make my reviewing a lot easier but also useless.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well I tested using database from #27322 (comment), which has ~80 collections. Opening the collections dialog increases the number of active subscriptions five-fold. I didn't see signs of falling over, surprisingly - even on mutations - but as predicted the subscriptions stay alive for the entirety of the remaining gameplay and the only thing that gets rid of them is deleting the collections. And 80 is probably not even that many collections.

I dunno, I'm still too skeptical to feel confident pushing this to users. It just feels way too shoddy to be keeping these subscriptions around when the dialog isn't even visible...

Copy link
Collaborator

Choose a reason for hiding this comment

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

I asked about this in a discussion and the realm team guidance is that this might be fine but can be improved upon, by either only watching for changes when the dialog is open, or using that new feature mentioned there and only ever using a single subscription in total.

// Intentionally not localised until we have proper support for this (see https://github.com/ppy/osu-framework/pull/4918
// but also in this case we want support for formatting a number within a string).
? $"{count:#,0} beatmap"
: $"{count:#,0} beatmaps";
Copy link
Member

Choose a reason for hiding this comment

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

As discussed in #23000, "beatmaps" is incorrect here. I would suggest "items" if we going with the same direction here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants