mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge pull request #18619 from peppy/fix-collection-performance
Fix performance overhead of large collections
This commit is contained in:
@ -72,7 +72,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
}
|
||||
|
||||
if (match)
|
||||
match &= criteria.Collection?.Beatmaps.Contains(BeatmapInfo) ?? true;
|
||||
match &= criteria.Collection?.BeatmapHashes.Contains(BeatmapInfo.MD5Hash) ?? true;
|
||||
|
||||
if (match && criteria.RulesetCriteria != null)
|
||||
match &= criteria.RulesetCriteria.Matches(BeatmapInfo);
|
||||
|
@ -256,12 +256,12 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
return new ToggleMenuItem(collection.Name.Value, MenuItemType.Standard, s =>
|
||||
{
|
||||
if (s)
|
||||
collection.Beatmaps.Add(beatmapInfo);
|
||||
collection.BeatmapHashes.Add(beatmapInfo.MD5Hash);
|
||||
else
|
||||
collection.Beatmaps.Remove(beatmapInfo);
|
||||
collection.BeatmapHashes.Remove(beatmapInfo.MD5Hash);
|
||||
})
|
||||
{
|
||||
State = { Value = collection.Beatmaps.Contains(beatmapInfo) }
|
||||
State = { Value = collection.BeatmapHashes.Contains(beatmapInfo.MD5Hash) }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
TernaryState state;
|
||||
|
||||
int countExisting = beatmapSet.Beatmaps.Count(b => collection.Beatmaps.Contains(b));
|
||||
int countExisting = beatmapSet.Beatmaps.Count(b => collection.BeatmapHashes.Contains(b.MD5Hash));
|
||||
|
||||
if (countExisting == beatmapSet.Beatmaps.Count)
|
||||
state = TernaryState.True;
|
||||
@ -261,14 +261,14 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
switch (s)
|
||||
{
|
||||
case TernaryState.True:
|
||||
if (collection.Beatmaps.Contains(b))
|
||||
if (collection.BeatmapHashes.Contains(b.MD5Hash))
|
||||
continue;
|
||||
|
||||
collection.Beatmaps.Add(b);
|
||||
collection.BeatmapHashes.Add(b.MD5Hash);
|
||||
break;
|
||||
|
||||
case TernaryState.False:
|
||||
collection.Beatmaps.Remove(b);
|
||||
collection.BeatmapHashes.Remove(b.MD5Hash);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user