Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Localized resources in the CLI adds 53 MB on disk and increases time-to-main by ~50%

See original GitHub issue

The CLI today includes resources for all languages for not only itself but all of its dependencies, including Roslyn, MSBuild, NuGet, and VSTest. This happens regardless of the locale of the machine the CLI is installed on.

The inclusion of all these resources results in:

  • ~53 MB of on-disk space (~24% of the CLI size on disk total)
  • 48 KB of the dotnet.deps.json file
  • An increase in time-to-main for the CLI of ~50% (due to size of deps.json file)
    • Measured on my desktop, removing the resources entries from the deps.json reduced time-to-main for the CLI from ~75ms to ~48ms

It doesn’t seem as though there’s any benefit to including all language resources in every install (i.e. I don’t personally get a benefit from all language resources other than English being installed).

The impact on time-to-main is particularly interesting with regards to the effort to improve the CLI performance for inner-loop scenarios in .NET 6 (see, offering a saving to the floor for the CLI’s time-to-main of at least 50% in local testing.

Here’s the results of a manual analysis of the resources files in the CLI installation I found today (using version 6.0.100-preview.2.21118.12 installed on Windows via the nightly installer):

Path Size on disk (Bytes) KB MB
root 17,461,248 17,052 16.65
DotnetTools\dotnet-watch\6.0.100-preview.1.21118.15\tools\net6.0\any 483,328 472 0.46
Extensions 1,122,304 1,096 1.07
FSharp 5,742,592 5,608 5.48
Microsoft\Microsoft.NET.BuildExtensions\tools\net6.0 512,000 500 0.49
Roslyn 266,240 260 0.25
Roslyn\bincore 9,486,336 9,264 9.05
Sdks\Microsoft.NET.Sdk\analyzers 3,592,192 3,508 3.43
Sdks\Microsoft.NET.Sdk\codestyle\cs 1,245,184 1,216 1.19
Sdks\Microsoft.NET.Sdk\codestyle\vb 1,134,592 1,108 1.08
Sdks\Microsoft.NET.Sdk\tools\net6.0 512,000 500 0.49
Sdks\Microsoft.NET.Sdk\tools\net472 512,000 500 0.49
Sdks\Microsoft.NET.Sdk.Publish\tools\net6.0 921,600 900 0.88
Sdks\Microsoft.NET.Sdk.Publish\tools\net472 921,600 900 0.88
Sdks\Microsoft.NET.Sdk.Razor\tasks\net6.0 5,103,616 4,984 4.87
Sdks\Microsoft.NET.Sdk.WindowsDesktop\tools\netcoreapp2.1 593,920 580 0.57
Sdks\Microsoft.NET.Sdk.WindowsDesktop\tools\net472 593,920 580 0.57
Sdks\NuGet.Build.Tasks.Pack\CoreCLR 2,011,136 1,964 1.92
Sdks\NuGet.Build.Tasks.Pack\Desktop 2,011,136 1,964 1.92
TestHost 1,716,224 1,676 1.64
Resources Total 55,943,168 54,632 53.35
CLI Total 288,780,288 282,012 275.40
Resources as a portion of overall CLI size on disk 24%

Note that we added support for selecting specific languages for satellite resources in 2.x:

Additionally, in my local testing I noted that completely removing the CLI’s deps.json file didn’t seem to impact the operation of the CLI itself. The commands I tried all continued to work perfectly well when the deps.json file was deleted.

While putting this table together I noticed a lot of duplication. You can see a bunch of size values appear identically a number of times as different components bring in the same dependencies, which bring in their resources again. It might be useful for that to investigated separately in the interest of simplifying the layout and thus install time and disk cost of the CLI.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:23 (20 by maintainers)

github_iconTop GitHub Comments

vitek-karascommented, Mar 10, 2021

@mateoatr and I are working on a host change which would forego file probes for pretty much all the files in the .deps.json - maybe even the resource files (those are tricky though). While not as good as removing parts of the .deps.json completely, it should help a LOT. So maybe if we combine all of these together it will give us enough of a win for 6.

marcpopMSFTcommented, Sep 29, 2021

Tracking as part of the optimize SDK size .net 7 planning document.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Allow disabling of copying resource assemblies from ...
Allow disabling of copying resource assemblies from NuGet packages ... Localized resources in the CLI adds 53 MB on disk and increases ......
Read more >
Chamilo Changelog
Documentation /; Changelog. Chamilo Changelog. This is our technical changelog, aimed at providing you a list of the new features, small changes and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found