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

JSInterop performance vs Blazorwebview #69

Open
orosbogdan opened this issue Jul 4, 2024 · 1 comment
Open

JSInterop performance vs Blazorwebview #69

orosbogdan opened this issue Jul 4, 2024 · 1 comment

Comments

@orosbogdan
Copy link

orosbogdan commented Jul 4, 2024

In regards to my question here dotnet/maui#13551, I'm trying to get a better performance while transfering arrays of objects from javascript to c# and from c# to javascript, so far I did it only with the blazorwebview that MAUI blazor hybrid offers and it's pretty slow (probably because of JSON serialization?).

I understand that IJSUnmarshalledRuntime is deprecated and the JSImport attribute is applicable only to webassembly.

Would this hybridwebview be able to host a website made with blazor webassembly ? If so would the performance for the js interop in case of arrays of objects being transfered be improved ?

@Eilon
Copy link
Owner

Eilon commented Jul 20, 2024

Hi @orosbogdan , in theory it should definitely be possible to host a Blazor WASM app in HybridWebView because it doesn't particularly 'care' what code it's hosting. You might be the first one to try it!

Regarding perf:

  1. In BlazorWebView in most cases there shouldn't need to be a lot of marshalling between the C# world and JS world because most app logic that deals with large datasets is entirely in C#, and can simply 'share' memory (e.g. via services, global statics, etc.).
  2. In cases where there is a need to transfer large amounts of data between C# and JS we'd have to look at the particular case where the performance is bad. On many platforms the native WebView controls used by HybridWebView/BlazorWebView offer more advanced ways to share data between those two worlds. While they are not directly exposed by the controls, it might be possible to access those mechanisms in app-specific code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants