dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.98k stars 1.72k forks source link

Mac Catalyst Webview very low frame rate #21412

Open vsg24 opened 5 months ago

vsg24 commented 5 months ago

Description

Currently I'm getting almost half as much framerate compared to running the same test directly in Safari or Chrome or Firefox. on a Using a 14 inch Macbook Pro with M2 Pro chip, opening the website testufo.com (which is one of the most reliable JS based performance tracking tools) shows this:

Screenshot 2024-03-23 at 19 39 05



This is similar to running Safari with Prefer Page Rendering Updates near 60fps developer flag disabled.

Screenshot 2024-03-23 at 19 47 34


Safari 17.4 with Prefer Page Rendering Updates near 60fps disabled:

Screenshot 2024-03-23 at 19 41 40


Safari 17.4 with Prefer Page Rendering Updates near 60fps enabled: (default, as far as I can tell)

Screenshot 2024-03-23 at 19 39 54

I have tried running the MAUI app with both Prefer Page Rendering Updates near 60fps being enabled and disabled but it appears to make no difference to the WebView

Steps to Reproduce

1- Create a simple WebView element like this <WebView x:Name="webView" Source="https://www.testufo.com/" /> and run the program

Expected: The program to run above 100fps like the native run on Safari with Prefer Page Rendering Updates near 60fps flag disabled. Actual: The program runs at a similar frames to running the test in Safari with Prefer Page Rendering Updates near 60fps flag enabled.

Link to public reproduction project repository

No response

Version with bug

8.0.10 SR3

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

macOS 13.6.4 Ventura Safari 17.4

Did you find any workaround?

No response

Relevant log output

No response

drasticactions commented 5 months ago

"Prefer Page Rendering Updates near 60fps" does nothing for WKWebView instances (the underlying iOS/Catalyst control used by MAUI) that won't change anything on its own for your applications, only Safari itself. I've created a standard Mac Catalyst app to show this.

You will hit the same limitation with any iOS or Mac app with WKWebView. There are no flags to change the 60 FPS behavior, so I believe you will see the same issue in any app which implements WKWebView, regardless of MAUI.

Unless someone like @rolfbjarne knows different, I think this should be closed. It would need to be something addressed by Apple as part of WKWebView, then bound to .NET.

rolfbjarne commented 5 months ago

Unless someone like @rolfbjarne knows different, I think this should be closed. It would need to be something addressed by Apple as part of WKWebView, then bound to .NET.

Agreed.

We could have a deeper look if we got an Xcode project using WKWebView where it works as desired though.