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

Load editor's verify tab asynchronously #28829

Closed
nolife99 opened this issue Jul 12, 2024 · 1 comment
Closed

Load editor's verify tab asynchronously #28829

nolife99 opened this issue Jul 12, 2024 · 1 comment

Comments

@nolife99
Copy link

Type

Performance

Bug description

When opening the verify tab in an editor, there is an uncomfortable freeze as AIMod checks the map synchronously. This problem is worse on longer maps.

Screenshots or videos

https://streamable.com/7kvkeg (Video was too large)
After clicking verify tab, the app hangs for more than 20 seconds. It might be less on others' machines.
Here is the map for testing: https://osu.ppy.sh/s/1729689

Version

2024.625.2

Logs

compressed-logs.zip

@peppy
Copy link
Sponsor Member

peppy commented Jul 12, 2024

Honestly we can make it asynchronous easily but the real overhead comes from laying out the list.

But the map you are testing with is just stupid and broken. So i'm not willing to put any extra effort into this.

osu! 2024-07-12 at 06 01 18

Note: 599 concurrent objects

If you have a beatmap which isn't broken that still loads slow then please provide that for testing.

If we ever need to, here's the async part which is simple to do:

diff --git a/osu.Game/Screens/Edit/Verify/IssueList.cs b/osu.Game/Screens/Edit/Verify/IssueList.cs
index de7b760bcd..567fdd03a2 100644
--- a/osu.Game/Screens/Edit/Verify/IssueList.cs
+++ b/osu.Game/Screens/Edit/Verify/IssueList.cs
@@ -5,6 +5,8 @@
 
 using System.Collections.Generic;
 using System.Linq;
+using System.Threading.Tasks;
+using JetBrains.Annotations;
 using osu.Framework.Allocation;
 using osu.Framework.Bindables;
 using osu.Framework.Graphics;
@@ -90,19 +92,34 @@ protected override void LoadComplete()
             Refresh();
         }
 
+        [CanBeNull]
+        private Task refreshOperation;
+
         public void Refresh()
         {
-            var issues = generalVerifier.Run(context);
+            if (refreshOperation?.IsCompleted == false)
+                return;
 
-            if (rulesetVerifier != null)
-                issues = issues.Concat(rulesetVerifier.Run(context));
+            table.Issues.Clear();
 
-            issues = filter(issues);
+            refreshOperation = Task.Run(() =>
+            {
+                IEnumerable<Issue> issues = generalVerifier.Run(context);
 
-            table.Issues.Clear();
-            table.Issues.AddRange(issues
-                                  .OrderBy(issue => issue.Template.Type)
-                                  .ThenBy(issue => issue.Check.Metadata.Category));
+                if (rulesetVerifier != null)
+                    issues = issues.Concat(rulesetVerifier.Run(context));
+
+                issues = filter(issues)
+                         .OrderBy(issue => issue.Template.Type)
+                         .ThenBy(issue => issue.Check.Metadata.Category)
+                         .ToArray();
+
+                Schedule(() =>
+                {
+                    table.Issues.AddRange(issues);
+                    refreshOperation = null;
+                });
+            });
         }
 
         private IEnumerable<Issue> filter(IEnumerable<Issue> issues)

@peppy peppy closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants