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

Profile delay on first uncover #104

Open
Flash0ver opened this issue Dec 15, 2021 · 3 comments
Open

Profile delay on first uncover #104

Flash0ver opened this issue Dec 15, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request game-app Web-Application

Comments

@Flash0ver
Copy link
Owner

Flash0ver commented Dec 15, 2021

The duration between the first click and the actual uncover of the selected cell is noticeable. Especially on the Hard difficulty.
Let's profile and find out where we could improve performance.

E.g. via (not sure which tool works with Blazor/WASM)

  • Visual Studio Profiler
  • dotTrace / Rider
  • Google Lighthouse
  • Browser's F12 tools

We may also need to check other tools.

@Flash0ver Flash0ver added enhancement New feature or request game-app Web-Application labels Dec 15, 2021
@Flash0ver Flash0ver added this to the F0.Minesweeper Reloaded milestone Dec 15, 2021
@dev-in-disguise dev-in-disguise self-assigned this Dec 27, 2021
@dev-in-disguise
Copy link
Collaborator

I've checked some things here already which I want to share so that I do not forget about them 🤕🤣

  • dotTrace: we can not use that. It's a tool that analyzes common .NET processes which a Blazor WASM app is not since it runs in the browser.
  • Google Lighthouse: is also not really a tool that we can use for this current use case. It's used for auditing a website on it's initial rendering and it seems like you can't audit something like a button click. At least not to my knowledge.
  • Browser's F12 tools: as a standalone profiler it doesn't add a lot for wasm apps. It's useful for getting the total time it took for the click to execute but the default output it produces doesn't clarify where the time was spent. What we can do to improve that is adding additional profiling info via a JSInterop call which utilizes either console.time/console.timeEnd or console.profile/console.profileEnd.
  • Visual Studio Profiler: would be perfectly sufficient if we just use the debug events. E.g. set a break point at the start of onclick and another one at the end of onclick. This way I can roughly analyze the execution times one by one to paint a picture on where most likely the issue stems from.

Apart from those initially in the issue mentioned ways I also looked up other things. But generally speaking there is no way to accurately profile a Blazor WASM application. There is an issue for that but it doesn't look like there's any progress.
I found MiniProfiler which sounds promising but it does not have Blazor support. There is an issue where someone tries to add it but hit some blockers. And there even does not seem to be a version of the currently working blazor support published on nuget. So that's out of the window too.

Generally I have a question: do we want to just fix this current issue or do we want to continue profiling the performance of previous slow performers? If it's the former I'd just use either the browers profiling with jsinterop or the Visual Studio Profiler. If it's the latter I'll continue my research.

@dev-in-disguise
Copy link
Collaborator

And here is the blog post which shows us how we can track performance via JSInterop that we talked about in todays session

@Flash0ver
Copy link
Owner Author

Flash0ver commented Jan 7, 2022

We discussed: since the performance issue is in the Logic library, let's not add any JavaScript/Blazor/WASM profiling for now - but later on when we actually do have a performance issue in either the App or Components project.
For this issue we find the class/method responsible within the Logic project, and add a [Benchmark] to see the before/after performance. See also issue dotnet/aspnetcore#64 / PR dotnet/aspnetcore#106 which adds BenchmarkDotNet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request game-app Web-Application
Projects
None yet
Development

No branches or pull requests

2 participants