Home: Allow compression level to be set when running `nuget pack`

Created on 26 May 2016  路  6Comments  路  Source: NuGet/Home

We use NuGet to package a lot of internal assemblies and programs, and we'd like to be able to set the compression level to either Fastest or NoCompression instead of the current Optimal. This is because we know there's a bunch of data in those NuGet packages which aren't compressable, and so nuget pack spends a bunch of time trying to compress the data when we don't need it to. This significantly increases our build times.

We'd like to able to do something similar to:

nuget pack -CompressionLevel NoCompression ...
Pack NuGet.exe DCR help wanted

All 6 comments

We would gladly take a pull request for this issue if you would like to speed it up

@hach-que I created a branch and test release of the 3.4.4-rtm build with compression hardcoded to off so that we could test performance and see if this change was worth it.

https://github.com/thesoftwarejedi/NuGet.Client/releases/tag/3.4.4-nct

I uploaded the binary in case anyone wanted a quick fix.

@thesoftwarejedi What were the performance improvements? I'm having issues with nuget pach when packing 20.000+ files, it takes around 10 minutes.

Confirm the information from @Saturate .

We also have a large project, about 20 000 files/ 250 MB, and use NuGet (latest stable v3.5.0) to pack this project for further transferring to Octopus Deploy.

It takes __3.5 - 6 minutes__ to run nuget pack -NoPackageAnalysis .nuspec in different Windows machines.

Default zip archiver seems to be a little bit faster, but also takes a lot of time. It would be nice to see the suggested lighter compression options and possibly some optimisation for large projects.

slow nuget pack

Currently I do not see evidence that changing the compression level would have a large enough impact on perf to justify this option. If someone can provide that please do 馃尫

We have a content-only NuGet package which contains 2 ZIPs totalling 750 MB that gets created as part of our CI pipeline. Considering the frequency of change of the mainline branch, a 40 sec difference does matter. I don't necessary need command line setting of the specific compression level. You could just say, use NoCompression on a file-by-file basis depending on the extension.

Was this page helpful?
0 / 5 - 0 ratings