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

[WASM] Major size regression in dotnet.wasm #50210

Closed
eerhardt opened this issue Mar 24, 2021 · 15 comments · Fixed by #50266
Closed

[WASM] Major size regression in dotnet.wasm #50210

eerhardt opened this issue Mar 24, 2021 · 15 comments · Fixed by #50266
Labels
arch-wasm WebAssembly architecture area-System.Runtime

Comments

@eerhardt
Copy link
Member

I'm seeing a 40KB regression on https://aka.ms/dotnetperfstatus:

image

Which all appears to be in the dotnet.wasm file:

image

It went from 782,610 bytes on aab9aa6 to 824,698 bytes on 8dd8a43.

There were 2 changes that went in during that range, both of them could be possibilities:

cc @mattjohnsonpint @lewing @CoffeeFlux

@eerhardt eerhardt added the arch-wasm WebAssembly architecture label Mar 24, 2021
@dotnet-issue-labeler
Copy link

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

@ghost
Copy link

ghost commented Mar 24, 2021

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

Issue Details

I'm seeing a 40KB regression on https://aka.ms/dotnetperfstatus:

image

Which all appears to be in the dotnet.wasm file:

image

It went from 782,610 bytes on aab9aa6 to 824,698 bytes on 8dd8a43.

There were 2 changes that went in during that range, both of them could be possibilities:

cc @mattjohnsonpint @lewing @CoffeeFlux

Author: eerhardt
Assignees: -
Labels:

arch-wasm

Milestone: -

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Mar 24, 2021
@lewing
Copy link
Member

lewing commented Mar 24, 2021

@eerhardt pretty sure it was #48931 my pr just removed completely unused files from a package only used by AOT tooling.

@mattjohnsonpint
Copy link
Contributor

I can look into it. Curious what amount of increase is acceptable, and what should I be looking to optimize? Is it just total number of instructions? There were a few strings and string arrays added as well. We had some discussion on that PR about whether a simple string array is better or worse than searching through one big string - not sure if either would have a size difference for wasm.

@mattjohnsonpint
Copy link
Contributor

Just to double check - we don't have ICU in the browser, right? I don't believe that is possible, but want to confirm.

Assuming not - I think it might be a good idea to have a TimeZoneInfo.Browser.cs split out from TimeZoneInfo.Unix.cs with only the parts needed for the browser. That should trim down the size considerably.

@lewing
Copy link
Member

lewing commented Mar 25, 2021

we have icu in the browser https://github.com/dotnet/icu/

@mattjohnsonpint
Copy link
Contributor

Does it pass through to ICU used by the browser somehow? Or we are bundling it in the wasm ourself?

@lewing
Copy link
Member

lewing commented Mar 25, 2021

we bundle icu and a filtered set of data, the globalization available via javascript isn't sufficient to support the .NET apis. It could be possible in some cases to fall back to the browser apis for certain specific data if it is available

@mattjohnsonpint
Copy link
Contributor

Ok. I'll see what else I can think of.

@mattjohnsonpint
Copy link
Contributor

Actually, since it appears we're only using the IANA ID and abbreviation for the time zone display names, it still makes sense to me to conditionally build TimeZoneInfo to trim out the ICU bits. Unless we are including time zone display names in the ICU data, but I don't think we are since the current tests show otherwise.

@lewing
Copy link
Member

lewing commented Mar 25, 2021

That is definitely an option. It's also possible that we can just hide a the new logic behind a feature flag that the illinker understands and we can break the reference chain.

@EgorBo
Copy link
Member

EgorBo commented Mar 25, 2021

From my understanding, all ICU data files for Browser currently strip everything related to timezones (including names for them), e.g.: https://github.com/dotnet/icu/blob/maint/maint-67/icu-filters/icudt.json#L198-L199

so all of those ICU functions must be linked out

@mattjohnsonpint
Copy link
Contributor

Working on this. Got a local wasm build going and doing some before/after size comparisons per @eerhardt's instructions. I'll report back shortly.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Mar 25, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Mar 30, 2021
@eerhardt
Copy link
Member Author

With the latest runs on https://aka.ms/dotnetperfstatus, I can confirm this is now fixed, and we are now slightly lower than the size before the regression came in:

image

Thanks again @mattjohnsonpint!

@mattjohnsonpint
Copy link
Contributor

Glad to help!

@ghost ghost locked as resolved and limited conversation to collaborators Apr 30, 2021
@tannergooding tannergooding removed the untriaged New issue has not been triaged by the area owner label Jun 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-System.Runtime
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants