From 0090de47c7f1d11250c2d650bf8892fa58acad33 Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Tue, 17 Jan 2023 08:02:30 -0500 Subject: [PATCH] Use CompressionLevel.SmallestSize in Bundler (#80372) --- .../managed/Microsoft.NET.HostModel/Bundle/Bundler.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/installer/managed/Microsoft.NET.HostModel/Bundle/Bundler.cs b/src/installer/managed/Microsoft.NET.HostModel/Bundle/Bundler.cs index 14315ed4e436b..47d7a350340af 100644 --- a/src/installer/managed/Microsoft.NET.HostModel/Bundle/Bundler.cs +++ b/src/installer/managed/Microsoft.NET.HostModel/Bundle/Bundler.cs @@ -101,7 +101,8 @@ private bool ShouldCompress(FileType type) // We use DeflateStream here. // It uses GZip algorithm, but with a trivial header that does not contain file info. - using (DeflateStream compressionStream = new DeflateStream(bundle, CompressionLevel.Optimal, leaveOpen: true)) + CompressionLevel smallestSize = (CompressionLevel)3; + using (DeflateStream compressionStream = new DeflateStream(bundle, Enum.IsDefined(typeof(CompressionLevel), smallestSize) ? smallestSize : CompressionLevel.Optimal, leaveOpen: true)) { file.CopyTo(compressionStream); }