From 91d206e8d2c0553266e5605ab454d0862c3e604b Mon Sep 17 00:00:00 2001 From: OliBomby Date: Fri, 3 Mar 2023 19:21:50 +0100 Subject: [PATCH 1/8] Optimised GetSearchableTerms Reduced memory allocations to 1 --- osu.Game/Beatmaps/BeatmapInfoExtensions.cs | 27 ++++++++++++--- .../Select/Carousel/CarouselBeatmap.cs | 34 ++++++++++++++++--- 2 files changed, 52 insertions(+), 9 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapInfoExtensions.cs b/osu.Game/Beatmaps/BeatmapInfoExtensions.cs index eab66b9857..e14a44ec58 100644 --- a/osu.Game/Beatmaps/BeatmapInfoExtensions.cs +++ b/osu.Game/Beatmaps/BeatmapInfoExtensions.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Linq; +using System; using osu.Framework.Localisation; namespace osu.Game.Beatmaps @@ -29,10 +29,29 @@ namespace osu.Game.Beatmaps return new RomanisableString($"{metadata.GetPreferred(true)}".Trim(), $"{metadata.GetPreferred(false)}".Trim()); } - public static string[] GetSearchableTerms(this IBeatmapInfo beatmapInfo) => new[] + public static ReadOnlySpan GetSearchableTerms(this IBeatmapInfo beatmapInfo) { - beatmapInfo.DifficultyName - }.Concat(beatmapInfo.Metadata.GetSearchableTerms()).Where(s => !string.IsNullOrEmpty(s)).ToArray(); + Span terms = new string[8]; + int i = 0; + if (!string.IsNullOrEmpty(beatmapInfo.DifficultyName)) + terms[i++] = beatmapInfo.DifficultyName; + var metadata = beatmapInfo.Metadata; + if (!string.IsNullOrEmpty(metadata.Author.Username)) + terms[i++] = metadata.Author.Username; + if (!string.IsNullOrEmpty(metadata.Artist)) + terms[i++] = metadata.Artist; + if (!string.IsNullOrEmpty(metadata.ArtistUnicode)) + terms[i++] = metadata.ArtistUnicode; + if (!string.IsNullOrEmpty(metadata.Title)) + terms[i++] = metadata.Title; + if (!string.IsNullOrEmpty(metadata.TitleUnicode)) + terms[i++] = metadata.TitleUnicode; + if (!string.IsNullOrEmpty(metadata.Source)) + terms[i++] = metadata.Source; + if (!string.IsNullOrEmpty(metadata.Tags)) + terms[i++] = metadata.Tags; + return terms[..i]; + } private static string getVersionString(IBeatmapInfo beatmapInfo) => string.IsNullOrEmpty(beatmapInfo.DifficultyName) ? string.Empty : $"[{beatmapInfo.DifficultyName}]"; } diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs index 837939716b..75bf8b2bbc 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs @@ -55,12 +55,31 @@ namespace osu.Game.Screens.Select.Carousel match &= !criteria.UserStarDifficulty.HasFilter || criteria.UserStarDifficulty.IsInRange(BeatmapInfo.StarRating); - if (match && criteria.SearchTerms.Length > 0) + if (!match) { - string[] terms = BeatmapInfo.GetSearchableTerms(); + Filtered.Value = !match; + return; + } + + if (criteria.SearchTerms.Length > 0) + { + var terms = BeatmapInfo.GetSearchableTerms(); foreach (string criteriaTerm in criteria.SearchTerms) - match &= terms.Any(term => term.Contains(criteriaTerm, StringComparison.InvariantCultureIgnoreCase)); + { + bool any = false; + + // ReSharper disable once LoopCanBeConvertedToQuery + foreach (string term in terms) + { + if (!term.Contains(criteriaTerm, StringComparison.InvariantCultureIgnoreCase)) continue; + + any = true; + break; + } + + match &= any; + } // if a match wasn't found via text matching of terms, do a second catch-all check matching against online IDs. // this should be done after text matching so we can prioritise matching numbers in metadata. @@ -71,8 +90,13 @@ namespace osu.Game.Screens.Select.Carousel } } - if (match) - match &= criteria.CollectionBeatmapMD5Hashes?.Contains(BeatmapInfo.MD5Hash) ?? true; + if (!match) + { + Filtered.Value = !match; + return; + } + + match &= criteria.CollectionBeatmapMD5Hashes?.Contains(BeatmapInfo.MD5Hash) ?? true; if (match && criteria.RulesetCriteria != null) match &= criteria.RulesetCriteria.Matches(BeatmapInfo); From 31854188348e34fc28ba34c63ba3bc215301ad43 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Sat, 4 Mar 2023 15:14:22 +0100 Subject: [PATCH 2/8] Add benchmarks for carousel beatmap filter --- .../BenchmarkCarouselFilter.cs | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 osu.Game.Benchmarks/BenchmarkCarouselFilter.cs diff --git a/osu.Game.Benchmarks/BenchmarkCarouselFilter.cs b/osu.Game.Benchmarks/BenchmarkCarouselFilter.cs new file mode 100644 index 0000000000..8f7027da17 --- /dev/null +++ b/osu.Game.Benchmarks/BenchmarkCarouselFilter.cs @@ -0,0 +1,123 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using BenchmarkDotNet.Attributes; +using osu.Game.Beatmaps; +using osu.Game.Rulesets; +using osu.Game.Screens.Select; +using osu.Game.Screens.Select.Carousel; + +namespace osu.Game.Benchmarks +{ + public class BenchmarkCarouselFilter : BenchmarkTest + { + private BeatmapInfo getExampleBeatmap() => new BeatmapInfo + { + Ruleset = new RulesetInfo + { + ShortName = "osu", + OnlineID = 0 + }, + StarRating = 4.0d, + Difficulty = new BeatmapDifficulty + { + ApproachRate = 5.0f, + DrainRate = 3.0f, + CircleSize = 2.0f, + }, + Metadata = new BeatmapMetadata + { + Artist = "The Artist", + ArtistUnicode = "check unicode too", + Title = "Title goes here", + TitleUnicode = "Title goes here", + Author = { Username = "The Author" }, + Source = "unit tests", + Tags = "look for tags too", + }, + DifficultyName = "version as well", + Length = 2500, + BPM = 160, + BeatDivisor = 12, + Status = BeatmapOnlineStatus.Loved + }; + + private CarouselBeatmap carouselBeatmap = null!; + private FilterCriteria criteria1 = null!; + private FilterCriteria criteria2 = null!; + private FilterCriteria criteria3 = null!; + private FilterCriteria criteria4 = null!; + private FilterCriteria criteria5 = null!; + private FilterCriteria criteria6 = null!; + + public override void SetUp() + { + var beatmap = getExampleBeatmap(); + beatmap.OnlineID = 20201010; + beatmap.BeatmapSet = new BeatmapSetInfo { OnlineID = 1535 }; + carouselBeatmap = new CarouselBeatmap(beatmap); + criteria1 = new FilterCriteria(); + criteria2 = new FilterCriteria + { + Ruleset = new RulesetInfo { ShortName = "catch" } + }; + criteria3 = new FilterCriteria + { + Ruleset = new RulesetInfo { OnlineID = 6 }, + AllowConvertedBeatmaps = true, + BPM = new FilterCriteria.OptionalRange + { + IsUpperInclusive = false, + Max = 160d + } + }; + criteria4 = new FilterCriteria + { + Ruleset = new RulesetInfo { OnlineID = 6 }, + AllowConvertedBeatmaps = true, + SearchText = "an artist" + }; + criteria5 = new FilterCriteria + { + Creator = new FilterCriteria.OptionalTextFilter { SearchTerm = "the author AND then something else" } + }; + criteria6 = new FilterCriteria { SearchText = "20201010" }; + } + + [Benchmark] + public void CarouselBeatmapFilter() + { + carouselBeatmap.Filter(criteria1); + } + + [Benchmark] + public void CriteriaMatchingSpecificRuleset() + { + carouselBeatmap.Filter(criteria2); + } + + [Benchmark] + public void CriteriaMatchingRangeMax() + { + carouselBeatmap.Filter(criteria3); + } + + [Benchmark] + public void CriteriaMatchingTerms() + { + carouselBeatmap.Filter(criteria4); + } + + [Benchmark] + public void CriteriaMatchingCreator() + { + carouselBeatmap.Filter(criteria5); + } + + [Benchmark] + public void CriteriaMatchingBeatmapIDs() + { + carouselBeatmap.Filter(criteria6); + } + } +} From b90c389ff04ffa90bce040bbaa3f531173f93867 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Sat, 4 Mar 2023 15:42:35 +0100 Subject: [PATCH 3/8] using List instead of Span in GetSearchableTerms --- osu.Game/Beatmaps/BeatmapInfoExtensions.cs | 39 +++++++++---------- .../Select/Carousel/CarouselBeatmap.cs | 2 +- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapInfoExtensions.cs b/osu.Game/Beatmaps/BeatmapInfoExtensions.cs index e14a44ec58..7e336dcde2 100644 --- a/osu.Game/Beatmaps/BeatmapInfoExtensions.cs +++ b/osu.Game/Beatmaps/BeatmapInfoExtensions.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; +using System.Collections.Generic; using osu.Framework.Localisation; namespace osu.Game.Beatmaps @@ -29,28 +29,25 @@ namespace osu.Game.Beatmaps return new RomanisableString($"{metadata.GetPreferred(true)}".Trim(), $"{metadata.GetPreferred(false)}".Trim()); } - public static ReadOnlySpan GetSearchableTerms(this IBeatmapInfo beatmapInfo) + public static List GetSearchableTerms(this IBeatmapInfo beatmapInfo) { - Span terms = new string[8]; - int i = 0; - if (!string.IsNullOrEmpty(beatmapInfo.DifficultyName)) - terms[i++] = beatmapInfo.DifficultyName; + var terms = new List(8); var metadata = beatmapInfo.Metadata; - if (!string.IsNullOrEmpty(metadata.Author.Username)) - terms[i++] = metadata.Author.Username; - if (!string.IsNullOrEmpty(metadata.Artist)) - terms[i++] = metadata.Artist; - if (!string.IsNullOrEmpty(metadata.ArtistUnicode)) - terms[i++] = metadata.ArtistUnicode; - if (!string.IsNullOrEmpty(metadata.Title)) - terms[i++] = metadata.Title; - if (!string.IsNullOrEmpty(metadata.TitleUnicode)) - terms[i++] = metadata.TitleUnicode; - if (!string.IsNullOrEmpty(metadata.Source)) - terms[i++] = metadata.Source; - if (!string.IsNullOrEmpty(metadata.Tags)) - terms[i++] = metadata.Tags; - return terms[..i]; + addIfNotNull(beatmapInfo.DifficultyName); + addIfNotNull(metadata.Author.Username); + addIfNotNull(metadata.Artist); + addIfNotNull(metadata.ArtistUnicode); + addIfNotNull(metadata.Title); + addIfNotNull(metadata.TitleUnicode); + addIfNotNull(metadata.Source); + addIfNotNull(metadata.Tags); + return terms; + + void addIfNotNull(string? s) + { + if (!string.IsNullOrEmpty(s)) + terms.Add(s); + } } private static string getVersionString(IBeatmapInfo beatmapInfo) => string.IsNullOrEmpty(beatmapInfo.DifficultyName) ? string.Empty : $"[{beatmapInfo.DifficultyName}]"; diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs index 75bf8b2bbc..eb9fd09224 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs @@ -69,7 +69,7 @@ namespace osu.Game.Screens.Select.Carousel { bool any = false; - // ReSharper disable once LoopCanBeConvertedToQuery + // ReSharper disable once ForeachCanBeConvertedToQueryUsingAnotherGetEnumerator foreach (string term in terms) { if (!term.Contains(criteriaTerm, StringComparison.InvariantCultureIgnoreCase)) continue; From 70a925aab178706afc2fedff3c3ed47ec1f72002 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Sat, 4 Mar 2023 16:49:33 +0100 Subject: [PATCH 4/8] added extra early-returns --- osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs index eb9fd09224..2cfa163b7a 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs @@ -49,6 +49,12 @@ namespace osu.Game.Screens.Select.Carousel match &= !criteria.BeatDivisor.HasFilter || criteria.BeatDivisor.IsInRange(BeatmapInfo.BeatDivisor); match &= !criteria.OnlineStatus.HasFilter || criteria.OnlineStatus.IsInRange(BeatmapInfo.Status); + if (!match) + { + Filtered.Value = !match; + return; + } + match &= !criteria.Creator.HasFilter || criteria.Creator.Matches(BeatmapInfo.Metadata.Author.Username); match &= !criteria.Artist.HasFilter || criteria.Artist.Matches(BeatmapInfo.Metadata.Artist) || criteria.Artist.Matches(BeatmapInfo.Metadata.ArtistUnicode); @@ -78,7 +84,10 @@ namespace osu.Game.Screens.Select.Carousel break; } - match &= any; + if (any) continue; + + match = false; + break; } // if a match wasn't found via text matching of terms, do a second catch-all check matching against online IDs. From 5146f7c9784b38988b5dbfa2397e91330dd942dc Mon Sep 17 00:00:00 2001 From: OliBomby Date: Sat, 4 Mar 2023 16:49:46 +0100 Subject: [PATCH 5/8] using array again in GetSearchableTerms --- osu.Game/Beatmaps/BeatmapInfoExtensions.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapInfoExtensions.cs b/osu.Game/Beatmaps/BeatmapInfoExtensions.cs index 7e336dcde2..7d6667cdcd 100644 --- a/osu.Game/Beatmaps/BeatmapInfoExtensions.cs +++ b/osu.Game/Beatmaps/BeatmapInfoExtensions.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using osu.Framework.Localisation; @@ -29,9 +30,10 @@ namespace osu.Game.Beatmaps return new RomanisableString($"{metadata.GetPreferred(true)}".Trim(), $"{metadata.GetPreferred(false)}".Trim()); } - public static List GetSearchableTerms(this IBeatmapInfo beatmapInfo) + public static ReadOnlySpan GetSearchableTerms(this IBeatmapInfo beatmapInfo) { - var terms = new List(8); + string[] terms = new string[8]; + int i = 0; var metadata = beatmapInfo.Metadata; addIfNotNull(beatmapInfo.DifficultyName); addIfNotNull(metadata.Author.Username); @@ -41,12 +43,12 @@ namespace osu.Game.Beatmaps addIfNotNull(metadata.TitleUnicode); addIfNotNull(metadata.Source); addIfNotNull(metadata.Tags); - return terms; + return terms.AsSpan(0, i); void addIfNotNull(string? s) { if (!string.IsNullOrEmpty(s)) - terms.Add(s); + terms[i++] = s; } } From b0cd801405c26fe325cd11aad75a6e2734c198a5 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Sat, 4 Mar 2023 19:34:22 +0100 Subject: [PATCH 6/8] fix code quality --- osu.Game/Beatmaps/BeatmapInfoExtensions.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapInfoExtensions.cs b/osu.Game/Beatmaps/BeatmapInfoExtensions.cs index 7d6667cdcd..460944d2fa 100644 --- a/osu.Game/Beatmaps/BeatmapInfoExtensions.cs +++ b/osu.Game/Beatmaps/BeatmapInfoExtensions.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Collections.Generic; using osu.Framework.Localisation; namespace osu.Game.Beatmaps From 1fcf41379d5d5c37d211644fc96e4e99c4710ab0 Mon Sep 17 00:00:00 2001 From: OliBomby Date: Mon, 6 Mar 2023 16:20:36 +0100 Subject: [PATCH 7/8] Added maintainability patch by bdach --- osu.Game/Beatmaps/BeatmapInfoExtensions.cs | 22 +++++------- .../Beatmaps/BeatmapMetadataInfoExtensions.cs | 35 +++++++++++++------ 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapInfoExtensions.cs b/osu.Game/Beatmaps/BeatmapInfoExtensions.cs index 460944d2fa..3aab9a24e1 100644 --- a/osu.Game/Beatmaps/BeatmapInfoExtensions.cs +++ b/osu.Game/Beatmaps/BeatmapInfoExtensions.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; +using System.Collections.Generic; using osu.Framework.Localisation; namespace osu.Game.Beatmaps @@ -29,25 +29,19 @@ namespace osu.Game.Beatmaps return new RomanisableString($"{metadata.GetPreferred(true)}".Trim(), $"{metadata.GetPreferred(false)}".Trim()); } - public static ReadOnlySpan GetSearchableTerms(this IBeatmapInfo beatmapInfo) + public static List GetSearchableTerms(this IBeatmapInfo beatmapInfo) { - string[] terms = new string[8]; - int i = 0; - var metadata = beatmapInfo.Metadata; + var termsList = new List(BeatmapMetadataInfoExtensions.MAX_SEARCHABLE_TERM_COUNT + 1); + addIfNotNull(beatmapInfo.DifficultyName); - addIfNotNull(metadata.Author.Username); - addIfNotNull(metadata.Artist); - addIfNotNull(metadata.ArtistUnicode); - addIfNotNull(metadata.Title); - addIfNotNull(metadata.TitleUnicode); - addIfNotNull(metadata.Source); - addIfNotNull(metadata.Tags); - return terms.AsSpan(0, i); + + BeatmapMetadataInfoExtensions.CollectSearchableTerms(beatmapInfo.Metadata, termsList); + return termsList; void addIfNotNull(string? s) { if (!string.IsNullOrEmpty(s)) - terms[i++] = s; + termsList.Add(s); } } diff --git a/osu.Game/Beatmaps/BeatmapMetadataInfoExtensions.cs b/osu.Game/Beatmaps/BeatmapMetadataInfoExtensions.cs index 738bdb0839..fe4e815e62 100644 --- a/osu.Game/Beatmaps/BeatmapMetadataInfoExtensions.cs +++ b/osu.Game/Beatmaps/BeatmapMetadataInfoExtensions.cs @@ -3,7 +3,7 @@ #nullable disable -using System.Linq; +using System.Collections.Generic; using osu.Framework.Localisation; namespace osu.Game.Beatmaps @@ -13,16 +13,31 @@ namespace osu.Game.Beatmaps /// /// An array of all searchable terms provided in contained metadata. /// - public static string[] GetSearchableTerms(this IBeatmapMetadataInfo metadataInfo) => new[] + public static string[] GetSearchableTerms(this IBeatmapMetadataInfo metadataInfo) { - metadataInfo.Author.Username, - metadataInfo.Artist, - metadataInfo.ArtistUnicode, - metadataInfo.Title, - metadataInfo.TitleUnicode, - metadataInfo.Source, - metadataInfo.Tags - }.Where(s => !string.IsNullOrEmpty(s)).ToArray(); + var termsList = new List(MAX_SEARCHABLE_TERM_COUNT); + CollectSearchableTerms(metadataInfo, termsList); + return termsList.ToArray(); + } + + internal const int MAX_SEARCHABLE_TERM_COUNT = 7; + + internal static void CollectSearchableTerms(IBeatmapMetadataInfo metadataInfo, IList termsList) + { + addIfNotNull(metadataInfo.Author.Username); + addIfNotNull(metadataInfo.Artist); + addIfNotNull(metadataInfo.ArtistUnicode); + addIfNotNull(metadataInfo.Title); + addIfNotNull(metadataInfo.TitleUnicode); + addIfNotNull(metadataInfo.Source); + addIfNotNull(metadataInfo.Tags); + + void addIfNotNull(string s) + { + if (!string.IsNullOrEmpty(s)) + termsList.Add(s); + } + } /// /// A user-presentable display title representing this metadata. From 5af41bb1c81054205c4cb77ccc9b0faf4686288d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 7 Mar 2023 17:24:17 +0900 Subject: [PATCH 8/8] Move filter matching code into own method to simplify early returns --- .../Select/Carousel/CarouselBeatmap.cs | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs index 2cfa163b7a..7e48bc5cdd 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs @@ -26,6 +26,11 @@ namespace osu.Game.Screens.Select.Carousel { base.Filter(criteria); + Filtered.Value = !checkMatch(criteria); + } + + private bool checkMatch(FilterCriteria criteria) + { bool match = criteria.Ruleset == null || BeatmapInfo.Ruleset.ShortName == criteria.Ruleset.ShortName || @@ -34,8 +39,7 @@ namespace osu.Game.Screens.Select.Carousel if (BeatmapInfo.BeatmapSet?.Equals(criteria.SelectedBeatmapSet) == true) { // only check ruleset equality or convertability for selected beatmap - Filtered.Value = !match; - return; + return match; } match &= !criteria.StarDifficulty.HasFilter || criteria.StarDifficulty.IsInRange(BeatmapInfo.StarRating); @@ -49,11 +53,7 @@ namespace osu.Game.Screens.Select.Carousel match &= !criteria.BeatDivisor.HasFilter || criteria.BeatDivisor.IsInRange(BeatmapInfo.BeatDivisor); match &= !criteria.OnlineStatus.HasFilter || criteria.OnlineStatus.IsInRange(BeatmapInfo.Status); - if (!match) - { - Filtered.Value = !match; - return; - } + if (!match) return false; match &= !criteria.Creator.HasFilter || criteria.Creator.Matches(BeatmapInfo.Metadata.Author.Username); match &= !criteria.Artist.HasFilter || criteria.Artist.Matches(BeatmapInfo.Metadata.Artist) || @@ -61,11 +61,7 @@ namespace osu.Game.Screens.Select.Carousel match &= !criteria.UserStarDifficulty.HasFilter || criteria.UserStarDifficulty.IsInRange(BeatmapInfo.StarRating); - if (!match) - { - Filtered.Value = !match; - return; - } + if (!match) return false; if (criteria.SearchTerms.Length > 0) { @@ -99,18 +95,14 @@ namespace osu.Game.Screens.Select.Carousel } } - if (!match) - { - Filtered.Value = !match; - return; - } + if (!match) return false; match &= criteria.CollectionBeatmapMD5Hashes?.Contains(BeatmapInfo.MD5Hash) ?? true; if (match && criteria.RulesetCriteria != null) match &= criteria.RulesetCriteria.Matches(BeatmapInfo); - Filtered.Value = !match; + return match; } public override int CompareTo(FilterCriteria criteria, CarouselItem other)