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

Minimizing size of Dotnet WebAssembly Browser app #87617

Closed
sps014 opened this issue Jun 15, 2023 · 8 comments
Closed

Minimizing size of Dotnet WebAssembly Browser app #87617

sps014 opened this issue Jun 15, 2023 · 8 comments
Assignees
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration
Milestone

Comments

@sps014
Copy link

sps014 commented Jun 15, 2023

Hello, I have Dotnet WebAssembly Browser app. The size of default dotnet.native.wasm with .Net 8 preview 5 is 2.8 MB.

On other hand In blazor WebAssembly app we can have PublishTrimmed and TrimMode to reduce the size to 300-400 KB. These 2 properties do not have effect on Web Assembly Browser app. Trimming doesn't takes place. Also Is there way to trim timezone and other data.

Is there any way to allow trimming to get smaller dotnet wasm in Web assembly browser application? Is there any roadmap for it similar to blazor size reduction tasks?

Thanks

@sps014 sps014 added the api-suggestion Early API idea and discussion, it is NOT ready for implementation label Jun 15, 2023
@martincostello martincostello removed the api-suggestion Early API idea and discussion, it is NOT ready for implementation label Jun 15, 2023
@javiercn javiercn transferred this issue from dotnet/aspnetcore Jun 15, 2023
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jun 15, 2023
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jun 15, 2023
@teo-tsirpanis teo-tsirpanis added the arch-wasm WebAssembly architecture label Jun 15, 2023
@ghost
Copy link

ghost commented Jun 15, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Hello, I have Dotnet WebAssembly Browser app. The size of default dotnet.native.wasm with .Net 8 preview 5 is 2.8 MB.

On other hand In blazor WebAssembly app we can have PublishTrimmed and TrimMode to reduce the size to 300-400 KB. These 2 properties do not have effect on Web Assembly Browser app. Trimming doesn't takes place. Also Is there way to trim timezone and other data.

Is there any way to allow trimming to get smaller dotnet wasm in Web assembly browser application? Is there any roadmap for it similar to blazor size reduction tasks?

Thanks

Author: sps014
Assignees: -
Labels:

arch-wasm, untriaged, needs-area-label

Milestone: -

@lewing lewing added this to the 8.0.0 milestone Jun 16, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jun 16, 2023
@lewing
Copy link
Member

lewing commented Jun 16, 2023

Are you publishing the app? Is PublishTrimmed set to true?

@sps014
Copy link
Author

sps014 commented Jun 16, 2023

Are you publishing the app? Is PublishTrimmed set to true?

Yes , I used these flags in csproj.
These flags seems to have no effect when publishing.

@lewing lewing added api-needs-work API needs work before it is approved, it is NOT ready for implementation and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners api-needs-work API needs work before it is approved, it is NOT ready for implementation labels Jun 16, 2023
@maraf
Copy link
Member

maraf commented Jun 21, 2023

We are on a journey to unify behavior between Blazor and WebAssembly Browser app. Roadmap for this work is in #70762.

I'll check the PublishTrimmed and TrimMode flags.

Timezone trimming is currently not possible due to change how it's delivered and we are working on enabling it again #87284

@maraf
Copy link
Member

maraf commented Jun 21, 2023

Both PublishTrimmed and TrimMode are set by default publishing both the WebAssembly app and Blazor app.

I got the same size for dotnet.native.wasm in both apps on .NET 8 preview 5 (~ 2.6MB).

You can disable globalization with InvariantGlobalization=true (~ 1.3 MB). Finally you can save some KB with EventSourceSupport=false and UseSystemResourceKeys=true. More info at https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options#trimming-framework-library-features

The timezone data has ~ 300KB which is not trimmable at the moment. With brotli compression it should get to ~ 400 KB.

@maraf maraf added the needs-author-action An issue or pull request that requires more info or actions from the author. label Jun 21, 2023
@ghost
Copy link

ghost commented Jun 21, 2023

This issue has been marked needs-author-action and may be missing some important information.

@sps014
Copy link
Author

sps014 commented Jun 22, 2023

@maraf Thanks for this valuable information.

@ghost ghost added needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration and removed needs-author-action An issue or pull request that requires more info or actions from the author. labels Jun 22, 2023
@maraf
Copy link
Member

maraf commented Jun 23, 2023

I'm happy to help! I'm going to close this issue, feel free to reopen it or open a new one if you have further questions.

@maraf maraf closed this as completed Jun 23, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Jul 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration
Projects
None yet
Development

No branches or pull requests

6 participants