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

[Browser] Publish experience compared to Blazor WebAssembly #11030

Closed
nxtn-staged opened this issue Apr 17, 2023 · 3 comments
Closed

[Browser] Publish experience compared to Blazor WebAssembly #11030

nxtn-staged opened this issue Apr 17, 2023 · 3 comments

Comments

@nxtn-staged
Copy link

It seems that the publish experience of Blazor WebAssembly is better polished. I'm not familiar with these WebAssembly stuff, but I'm wondering if we can reuse their optimizations or have to roll our own.

Example of steps to reproduce:

Avalonia

dotnet new avalonia.xplat -o Test.Avalonia -f net7.0
cd .\Test.Avalonia\Test.Avalonia.Browser\
dotnet workload restore
dotnet publish -c Release
dotnet serve --directory .\bin\Release\net7.0\browser-wasm\AppBundle\

When accessed twice from Microsoft Edge version 112:

  1. 45 requests 14.8 MB transferred 14.8 MB resources
  2. 45 requests 0 B transferred 14.8 MB resources

When accessed twice from Firefox version 112:

  1. 45 requests 14.78 MB / 14.79 MB transferred
  2. 45 requests 14.78 MB / 6.25 MB transferred

Blazor

dotnet new blazorwasm -o Test.Blazor -f net7.0
cd .\Test.Blazor\
dotnet workload restore
dotnet publish -c Release
dotnet serve --directory .\bin\Release\net7.0\publish\wwwroot\

When accessed twice from Microsoft Edge version 112:

  1. 42 requests 5.9 MB transferred 5.9 MB resources
  2. 10 requests 208 B transferred 513 kB resources

When accessed twice from Firefox version 112:

  1. 42 requests 5.91 MB / 5.92 MB transferred
  2. 42 requests 5.91 MB / 0 B transferred

The following is a non-exhaustive list of differences.

  • Blazor automatically generates Brotli/Gzip compressed static files (not used in the repro steps above).
  • Blazor only fetches static files once on Chromium, so it doesn't rely on the browser's caching behavior and is probably faster.
  • Avalonia doesn't publish the app into the publish folder, making it difficult to separate the publish artifacts from the build artifacts.

You can find more information about Blazor WebAssembly on https://learn.microsoft.com/aspnet/core/blazor/host-and-deploy/webassembly.

@maxkatz6
Copy link
Member

I think it's not the right place for this issue, as dotnet team manages app publishing process.

In general, I need to say that WebAssembly (no-Blazor) app is smaller (assuming it was compressed with the same algorithm, what you still can do automatically on static web servers), and faster.
Not sure if saving binaries in the local storage is faster than browser build-in caching, could be.

@maxkatz6
Copy link
Member

dotnet/runtime issue already exists for that:
dotnet/runtime#70762

@nxtn-staged
Copy link
Author

Thank you, so these are not issues specific to Avalonia, and there's not much to do here.

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

2 participants