Skip to content

Fix br compression size regression in Blazor WASM - #27659

Merged
eerhardt merged 1 commit into
dotnet:release/7.0.1xxfrom
eerhardt:FixDefaultCompression
Sep 6, 2022
Merged

eerhardt merged 1 commit into
dotnet:release/7.0.1xxfrom
eerhardt:FixDefaultCompression

Conversation

@eerhardt

@eerhardt eerhardt commented Sep 2, 2022 •

Copy link
Copy Markdown
Member

Reacting to dotnet/runtime#72266, which changed CompressionLevel.Optimal to no longer mean "smallest size", but instead a balance between compression speed and output size. In Blazor WASM publishing, we really want smallest size - it is preferred to spend more time during publish in order for less bytes to be downloaded and cached in the browser.

The fix is to change the default compression level to SmallestSize in the brotli tool used by WASM publish.

Here are my numbers I captured locally from doing dotnet publish -c Release with a dotnet new blazorwasm app.

  all .br file size BroltiCompress Task Time
preview.7.22375.6 2.58 MB 6.2s
rc.1.22431.11 3.29 MB 231ms
dotnet/sdk/release/7.0.1xx 3.28 MB 209ms
dotnet/sdk/thisFix 2.64 MB 7.6s

This fixes this regression seen on our size perf chart:

image

Reacting to dotnet/runtime#72266, which changed CompressionLevel.Optimal to no longer mean "smallest size", but instead a balance between compression speed and output size. In Blazor WASM publishing, we really want smallest size - it is preferred to spend more time during publish in order for less bytes to be downloaded and cached in the browser.

The fix is to change the default compression level to SmallestSize in the brotli tool used by WASM publish.
@ghost

ghost commented Sep 2, 2022

Copy link
Copy Markdown

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@eerhardt eerhardt added Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, StaticWebAssetsSDK arch-wasm labels Sep 2, 2022

@javiercn javiercn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @eerhardt I was reading about this change last week and I thought we should react too. Thanks for being proactive about it 👍

@eerhardt
eerhardt merged commit a8e9c11 into dotnet:release/7.0.1xx Sep 6, 2022
@eerhardt
eerhardt deleted the FixDefaultCompression branch September 6, 2022 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-wasm Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, StaticWebAssetsSDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants