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

Blazor Desktop tenets: Performance #2531

Closed
Eilon opened this issue Feb 27, 2021 · 17 comments
Closed

Blazor Desktop tenets: Performance #2531

Eilon opened this issue Feb 27, 2021 · 17 comments
Assignees
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView discussed Created by mkArtakMSFT to help with planning temporarily. It will be removed after planning is done. platform/android 🤖 platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst platform/windows 🪟 t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)
Milestone

Comments

@Eilon
Copy link
Member

Eilon commented Feb 27, 2021

  • Define perf goals and scenarios w/ specific #'s that we will target
  • Build scenarios on main competitors and ours
  • Automate measurements on relevant platforms
  • Need to review guidance from docs of each native WebView component for any best practices

A feature to consider:

  • Enable pooling of WebViews and/or enable external creation of WebViews (from some externally-existing pool). This technique is used in major apps that often have multiple web views but only a subset of them are visible at one time.
@ghost
Copy link

ghost commented Mar 1, 2021

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@SteveSandersonMS
Copy link
Member

Enable pooling of WebViews and/or enable external creation of WebViews (from some externally-existing pool). This technique is used in major apps that often have multiple web views but only a subset of them are visible at one time.

On this, it would be good to check with the WebView2 authors what they consider to be good practice or not. It might be that they already do some pooling of the underlying native resources (processes, etc.), in which case we wouldn't benefit from adding a further layer of pooling.

@Eilon
Copy link
Member Author

Eilon commented Mar 8, 2021

@SteveSandersonMS for sure we should talk to them too, but I have a contact in a major product group who says they already do this for perf (rightly or wrongly). So we'll take both answers and average them out 😄 They also pre-load WebView because their app can often anticipate that a new WebView will be needed "soon" so they pre-load it so that it's ready to go by the time it's needed.

@Eilon Eilon transferred this issue from dotnet/aspnetcore Sep 16, 2021
@Eilon Eilon added the area-blazor Blazor Hybrid / Desktop, BlazorWebView label Sep 16, 2021
@Eilon
Copy link
Member Author

Eilon commented Dec 13, 2021

We need to measure the basics in comparison to similar non-Blazor MAUI scenarios:

  • Size on disk for installers and in deployed apps
  • Memory usage
  • Startup time to an interactive app

@MichaelPeter
Copy link

MichaelPeter commented Feb 15, 2022

Could you also consider JSInterop Performance? In Blazor Webassembly there is the IJsUnmarshalled Runtime, which allowed up to 250.000 calls per second in our tests. Since in Blazor Hybrid, the communication goes over IPC (At Least in WPF), the number of javascript calls in our tests was limited to arround 1000 calls per second.

In Renderloops (Using for example WebGL or WebGPU) that would limit the best case number of calls per frame to 16 at 60fps or 8 at 120fps.

@darianmiller
Copy link

"Responsiveness" is a key metric but can be difficult to quantitate. Perhaps screen redraw speed of a moderately complex UI.

@mkArtakMSFT mkArtakMSFT modified the milestone: .NET 7 Feb 23, 2022
@mkArtakMSFT mkArtakMSFT added this to the 6.0.300-rc.2 milestone Mar 23, 2022
@mkArtakMSFT
Copy link
Member

Summary

Below is the list that we are going to measure for GA release.

  • Startup time / Time to first component UI render (within WebView)
  • Size of the installer for new Blazor MAUI app (per-platform)
  • Memory usage of a running default app (per-platform)

Delayed until .NET 7

  • Metrics for WPF and WinForms
  • Rendering performance (to be comparable with the WASM UI rendering?)

@radderz
Copy link

radderz commented May 2, 2022

I was quite surprised after getting our blazor wasm app working in Maui.NET Blazor hybrid that the performance was actually significantly worse. Is this expected? Is it due to the rendering performance mentioned that is delayed till .NET 7?

I had expected to have higher performance since we weren't limited by webassembly and being in IL mode (it was slower and we weren't using AOT).

@SteveSandersonMS
Copy link
Member

@radderz If you're able to provide a minimal repro we can definitely take a look. Otherwise, this is very unexpected.

@radderz
Copy link

radderz commented May 3, 2022

@SteveSandersonMS I'll try to put together a repro, its not clear what is the exact cause of the slowness as I haven't delved into it deeply yet but I was expecting the speed to be an improvement. Its always possible we are just doing something wrong, so will try to reproduce it in a simple example.

@Eilon
Copy link
Member Author

Eilon commented May 3, 2022

@radderz that would be great. Also please let us know what platform it was on, and if it's a mobile device, whether it's a physical device or emulator. There are certainly cases where a debug-built app in an emulator can appear slow because there's various extra debug things going on at various levels (such as more logging).

@Redth Redth added p/3 Work that is nice to have and removed p/2 Work that is important, but is currently not scheduled for release labels May 3, 2022
@radderz
Copy link

radderz commented May 3, 2022

@Eilon - It was on both windows and running on windows subsystem for android. They were debug builds but so was the webapp. I am using the mudblazor UI library and the slow down is when deserialising data from OData and updating a grid UI with large amounts of data (the grids are virtualized though).

I probably cant setup the example today but I'll try to do it tomorrow.

@Eilon
Copy link
Member Author

Eilon commented May 3, 2022

@radderz thank you for the extra info. If you can provide a repro for it that will be very helpful so we can try to reproduce exactly what you're seeing.

@mkArtakMSFT mkArtakMSFT removed the p/3 Work that is nice to have label May 4, 2022
@mkArtakMSFT mkArtakMSFT modified the milestones: 6.0.300, .NET 7 May 24, 2022
@mkArtakMSFT mkArtakMSFT added the discussed Created by mkArtakMSFT to help with planning temporarily. It will be removed after planning is done. label Jun 29, 2022
@TanayParikh
Copy link
Contributor

Just a bit of an update on where things stand currently. We have added automated coverage for iOS, Mac Catalyst and Android. We're collecting stats on size on disk, size of the unpackaged application, as well as time to first render for Blazor (using the OnAfterRender hook).

Performance dashboard (requires appropriate permissions)

We're working on onboarding the Windows scenario presently. Currently, we can't directly Console log on Windows (#7821 (comment)), which is preventing us from marking the render event like we do on the other platforms.

@TanayParikh
Copy link
Contributor

We're working on onboarding the Windows scenario presently. Currently, we can't directly Console log on Windows (#7821 (comment)), which is preventing us from marking the render event like we do on the other platforms.

dotnet/performance#2526 was just merged earlier this week. That PR handles setting up the Windows environment (installing the WebView), as well as logging the Windows Blazor render event. The data hasn't been reflected on the performance dashboard yet, so we're still ironing some things out to figure out what the missing piece is.

@TanayParikh
Copy link
Contributor

TanayParikh commented Aug 11, 2022

Performance dashboard (requires appropriate permissions)

The .NET MAUI Windows benchmarks are now available for:

@TanayParikh
Copy link
Contributor

Closing this out now as completed! 😄

@TanayParikh TanayParikh modified the milestones: .NET 7, 7.0-rc1 Aug 11, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Sep 10, 2022
@Eilon Eilon added t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf) and removed legacy-area-perf Startup / Runtime performance labels May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Blazor Hybrid / Desktop, BlazorWebView discussed Created by mkArtakMSFT to help with planning temporarily. It will be removed after planning is done. platform/android 🤖 platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst platform/windows 🪟 t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)
Projects
None yet
Development

No branches or pull requests

9 participants