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

Compression support for single-file publish #44569

Closed
Genbox opened this issue Nov 12, 2020 · 4 comments
Closed

Compression support for single-file publish #44569

Genbox opened this issue Nov 12, 2020 · 4 comments

Comments

@Genbox
Copy link

Genbox commented Nov 12, 2020

As mentioned in the original single-file issue and in bottom of the single-file design doc, compression is something that is worth taking a look at.

A lot of applications would benefit from smaller executables. Not only is the user experience better as a smaller file means smaller download time, but it also benefits the data transfer costs.

Trimming has helped a lot, and the new .NET 5.0 single-file publish is a great improvement on what we had in .NET Core 3.1. However, a simple Hello World application is still 19 MB as a single-file executable. If I compress it with 7Z LZMA it is 6 MB.

A first step could be to implement deflate compression in the GenerateBundle Msbuild step, and then have the host decompress it in a streaming fashion from the bundle directly. This would incur a small overhead in startup time, so maybe it should have a switch - something like /p:SingleFileCompression=true.

It would be nice to have the compression algorithm pluggable, so if we ever get to have LZMA (see #1542), we can get even better compression ratio.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-Single-File untriaged New issue has not been triaged by the area owner labels Nov 12, 2020
@ghost
Copy link

ghost commented Nov 12, 2020

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


Issue meta data

Issue content: As mentioned in the [original single-file issue](https://github.com//issues/36590#issuecomment-696409066) and in bottom of the [single-file design doc](https://github.com/dotnet/designs/blob/main/accepted/2020/single-file/design.md), compression is something that is worth taking a look at.

A lot of applications would benefit from smaller executables. Not only is the user experience better as a smaller file means smaller download time, but it also benefits the data transfer costs.

Trimming has helped a lot, and the new .NET 5.0 single-file publish is a great improvement on what we had in .NET Core 3.1. However, a simple Hello World application is still 19 MB as a single-file executable. If I compress it with 7Z LZMA it is 6 MB.

A first step could be to implement deflate compression in the GenerateBundle Msbuild step, and then have the host decompress it in a streaming fashion from the bundle directly. This would incur a small overhead in startup time, so maybe it should have a switch - something like /p:SingleFileCompression=true.

It would be nice to have the compression algorithm pluggable, so if we ever get to have LZMA (see #1542), we can get even better compression ratio.

Issue author: Genbox
Assignees: -
Milestone: -

@tmoonlight
Copy link

we need this function.

@NN---
Copy link
Contributor

NN--- commented Mar 30, 2021

#49855

@agocke
Copy link
Member

agocke commented Jul 15, 2021

This has been implemented as an optional switch for .NET 6.

@agocke agocke closed this as completed Jul 15, 2021
@agocke agocke removed the untriaged New issue has not been triaged by the area owner label Jul 15, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants