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] Trim TimeZoneInfo to reduce size #50266

Merged
merged 2 commits into from
Mar 30, 2021

Conversation

mattjohnsonpint
Copy link
Contributor

@mattjohnsonpint mattjohnsonpint commented Mar 25, 2021

This removes functions and related code from the browser wasm build target that were added recently with #48931 and #49412.

These never get called at runtime because neither time zone display name strings nor IANA to Windows time zone mapping data are included in the ICU data we ship with the browser.

Wasm (release) output sizes on my local machine:

Before change:

  • dotnet.wasm : 2,345 KB
  • dotnet.wasm.gz : 994 KB
  • dotnet.wasm.br : 806 KB
  • System.Private.CoreLib.dll : 1,149 KB
  • System.Private.CoreLib.dll.gz : 467 KB
  • System.Private.CoreLib.dll.br : 392 KB

After change:

  • dotnet.wasm : 2,222 KB
  • dotnet.wasm.gz : 940 KB
  • dotnet.wasm.br : 764 KB
  • System.Private.CoreLib.dll : 1,147 KB
  • System.Private.CoreLib.dll.gz : 466 KB
  • System.Private.CoreLib.dll.br : 391 KB

I think this should resolve #50210

@eerhardt @lewing

@ghost
Copy link

ghost commented Mar 25, 2021

Tagging subscribers to this area: @tarekgh, @safern
See info in area-owners.md if you want to be subscribed.

Issue Details

This removes functions and related code from the browser wasm build target that were added recently with #48931 and #49412.

These never get called at runtime because neither time zone display name strings nor IANA to Windows time zone mapping data are included in the ICU data we ship with the browser.

Wasm (releae) output sizes on my local machine:

Before change:

  • dotnet.wasm : 2,345 KB
  • dotnet.wasm.gz : 994 KB
  • dotnet.wasm.br : 806 KB
  • System.Private.CoreLib.dll : 1,149 KB
  • System.Private.CoreLib.dll.gz : 467 KB
  • System.Private.CoreLib.dll.br : 392 KB

After change:

  • dotnet.wasm : 2,222 KB
  • dotnet.wasm.gz : 940 KB
  • dotnet.wasm.br : 764 KB
  • System.Private.CoreLib.dll : 1,147 KB
  • System.Private.CoreLib.dll.gz : 466 KB
  • System.Private.CoreLib.dll.br : 391 KB

I think this should resolve #50210

@eerhardt @lewing

Author: mattjohnsonpint
Assignees: -
Labels:

area-System.Globalization

Milestone: -

@tarekgh
Copy link
Member

tarekgh commented Mar 25, 2021

@lewing want just to confirm would be ok excluding this function from the browser?

@danmoseley
Copy link
Member

cc @eerhardt

@danmoseley danmoseley requested a review from lewing March 26, 2021 00:13
@lewing
Copy link
Member

lewing commented Mar 26, 2021

Thanks for the fast turn around! This makes sense and my only thought is that we might be able to break the linkage with a new linker substitution rather than at build time. But that is more of a feature than an issue with this pr.

@marek-safar marek-safar added the size-reduction Issues impacting final app size primary for size sensitive workloads label Mar 26, 2021
@ghost
Copy link

ghost commented Mar 26, 2021

Tagging subscribers to 'size-reduction': @eerhardt, @SamMonoRT, @marek-safar, @tannergooding, @CoffeeFlux
See info in area-owners.md if you want to be subscribed.

Issue Details

This removes functions and related code from the browser wasm build target that were added recently with #48931 and #49412.

These never get called at runtime because neither time zone display name strings nor IANA to Windows time zone mapping data are included in the ICU data we ship with the browser.

Wasm (release) output sizes on my local machine:

Before change:

  • dotnet.wasm : 2,345 KB
  • dotnet.wasm.gz : 994 KB
  • dotnet.wasm.br : 806 KB
  • System.Private.CoreLib.dll : 1,149 KB
  • System.Private.CoreLib.dll.gz : 467 KB
  • System.Private.CoreLib.dll.br : 392 KB

After change:

  • dotnet.wasm : 2,222 KB
  • dotnet.wasm.gz : 940 KB
  • dotnet.wasm.br : 764 KB
  • System.Private.CoreLib.dll : 1,147 KB
  • System.Private.CoreLib.dll.gz : 466 KB
  • System.Private.CoreLib.dll.br : 391 KB

I think this should resolve #50210

@eerhardt @lewing

Author: mattjohnsonpint
Assignees: -
Labels:

area-System.Globalization, size-reduction

Milestone: -

@@ -22,9 +22,22 @@ public sealed partial class TimeZoneInfo
private const string ZoneTabFileName = "zone.tab";
private const string TimeZoneEnvironmentVariable = "TZ";
private const string TimeZoneDirectoryEnvironmentVariable = "TZDIR";

#if !TARGET_BROWSER
Copy link
Contributor

Choose a reason for hiding this comment

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

Why browser only? We use the same data on other platforms like tvOS

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a list of targets that use the filtered ICU data? Or a different flag I should use?

These can all be trimmed out, anywhere that the full ICU with time zone data is not available.

@mattjohnsonpint
Copy link
Contributor Author

Some of the checks failed for unrelated reasons. Would someone with permissions pleas click the button to re-run failed checks? Thanks.

I believe this is ready, otherwise.

@CoffeeFlux
Copy link
Contributor

Restarted the lanes for you. Thanks for your work here!

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

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

This LGTM. Thanks for the quick turnaround @mattjohnsonpint.

@tarekgh - any thoughts?

@tarekgh
Copy link
Member

tarekgh commented Mar 29, 2021

@tarekgh - any thoughts?

I am fine with the changes here if it is fine for the browser scenario. I already tagged @lewing and looks he is fine too. So, we are good to go.

@CoffeeFlux
Copy link
Contributor

Merging with Tarek's approval.

@CoffeeFlux CoffeeFlux merged commit 82c7051 into dotnet:main Mar 30, 2021
@mattjohnsonpint mattjohnsonpint deleted the timezoneinfo-wasm-size branch March 30, 2021 14:37
@DrewScoggins
Copy link
Member

We are seeing this gain back in the performance lab as shown here, DrewScoggins/performance-2#4858

@eerhardt
Copy link
Member

eerhardt commented Apr 6, 2021

@DrewScoggins - I'm not seeing it on https://aka.ms/dotnetperfstatus:

image

@DrewScoggins
Copy link
Member

I'm a little confused. We see the regression in the image that you posted between Mar 21-28, and then the fix went in and we went back down between Mar 28-Apr 04. Am I missing something?

@eerhardt
Copy link
Member

eerhardt commented Apr 6, 2021

I'm the one that was confused. By seeing this gain back, I thought you meant this size regression regressed again after it was fixed by this PR. "gain" was the confusing word, since a "gain in size" is bad.

I get it now - you were just confirming that the regression is fixed.

@ghost ghost locked as resolved and limited conversation to collaborators May 6, 2021
@karelz karelz added this to the 6.0.0 milestone May 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Globalization size-reduction Issues impacting final app size primary for size sensitive workloads
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[WASM] Major size regression in dotnet.wasm
9 participants