{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/4475","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/4475/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/4475/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/4475/events","html_url":"https://github.com/dotnet/corefx/issues/4475","id":116624416,"number":4475,"title":"Change ZLib Optimal CompressionLevel on Unix","user":{"login":"eerhardt","id":8291187,"avatar_url":"https://avatars.githubusercontent.com/u/8291187?v=3","gravatar_id":"","url":"https://api.github.com/users/eerhardt","html_url":"https://github.com/eerhardt","followers_url":"https://api.github.com/users/eerhardt/followers","following_url":"https://api.github.com/users/eerhardt/following{/other_user}","gists_url":"https://api.github.com/users/eerhardt/gists{/gist_id}","starred_url":"https://api.github.com/users/eerhardt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eerhardt/subscriptions","organizations_url":"https://api.github.com/users/eerhardt/orgs","repos_url":"https://api.github.com/users/eerhardt/repos","events_url":"https://api.github.com/users/eerhardt/events{/privacy}","received_events_url":"https://api.github.com/users/eerhardt/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dotnet/corefx/labels/System.IO.Compression","name":"System.IO.Compression","color":"d4c5f9"}],"state":"open","locked":false,"assignee":{"login":"eerhardt","id":8291187,"avatar_url":"https://avatars.githubusercontent.com/u/8291187?v=3","gravatar_id":"","url":"https://api.github.com/users/eerhardt","html_url":"https://github.com/eerhardt","followers_url":"https://api.github.com/users/eerhardt/followers","following_url":"https://api.github.com/users/eerhardt/following{/other_user}","gists_url":"https://api.github.com/users/eerhardt/gists{/gist_id}","starred_url":"https://api.github.com/users/eerhardt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eerhardt/subscriptions","organizations_url":"https://api.github.com/users/eerhardt/orgs","repos_url":"https://api.github.com/users/eerhardt/repos","events_url":"https://api.github.com/users/eerhardt/events{/privacy}","received_events_url":"https://api.github.com/users/eerhardt/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/dotnet/corefx/milestones/6","html_url":"https://github.com/dotnet/corefx/milestones/1.0.0-rc2","labels_url":"https://api.github.com/repos/dotnet/corefx/milestones/6/labels","id":1365455,"number":6,"title":"1.0.0-rc2","description":"","creator":{"login":"joshfree","id":1302850,"avatar_url":"https://avatars.githubusercontent.com/u/1302850?v=3","gravatar_id":"","url":"https://api.github.com/users/joshfree","html_url":"https://github.com/joshfree","followers_url":"https://api.github.com/users/joshfree/followers","following_url":"https://api.github.com/users/joshfree/following{/other_user}","gists_url":"https://api.github.com/users/joshfree/gists{/gist_id}","starred_url":"https://api.github.com/users/joshfree/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshfree/subscriptions","organizations_url":"https://api.github.com/users/joshfree/orgs","repos_url":"https://api.github.com/users/joshfree/repos","events_url":"https://api.github.com/users/joshfree/events{/privacy}","received_events_url":"https://api.github.com/users/joshfree/received_events","type":"User","site_admin":false},"open_issues":129,"closed_issues":61,"state":"open","created_at":"2015-10-20T04:29:15Z","updated_at":"2015-11-12T20:12:59Z","due_on":"2016-02-03T08:00:00Z","closed_at":null},"comments":9,"created_at":"2015-11-12T19:39:42Z","updated_at":"2015-11-12T20:23:10Z","closed_at":null,"body":"We currently have this comment and code in System.IO.Compression:\r\n\r\n```C#\r\n  // Note that ZLib currently exactly correspond to the optimal values.\r\n  // However, we have determined the optimal values by intependent measurements across\r\n  // a range of all possible ZLib parameters and over a set of different data.\r\n  // We stress that by using explicitly the values obtained by the measurements rather than\r\n  // ZLib defaults even if they happened to be the same.\r\n  // For ZLib 1.2.3 we have (copied from ZLibNative.cs):\r\n  // ZLibNative.CompressionLevel.DefaultCompression = 6;\r\n  // ZLibNative.Deflate_DefaultWindowBits = -15;\r\n  // ZLibNative.Deflate_DefaultMemLevel = 8;\r\n\r\n  case CompressionLevel.Optimal:\r\n      zlibCompressionLevel = (ZLibNative.CompressionLevel)6;\r\n      windowBits = -15;\r\n      memLevel = 8;\r\n      strategy = ZLibNative.CompressionStrategy.DefaultStrategy;\r\n      break;\r\n```\r\n\r\nSince we are now using the “current” ZLib version on Unix, and because we are planning on changing which version we use on Windows, I don’t think this is the best approach anymore. It was probably correct when we were hard-coding a version, but since we don’t know which version will actually be used, I think we should be letting the zlib library figure out which is the best compression level to use.\r\n\r\nI have 2 separate options on how to address this:\r\n1. On Unix, create a new shim method DeflateInit that only takes in the ZStream. The shim code will use the default values from the ZLib headers. Windows remains unchanged.\r\nhttps://github.com/eerhardt/corefx/commit/c1be54d6dfaf64098b42c186c041344e4378f083\r\n2. Change both Windows and Unix code to always use the default compression level (-1) and let the zlib version pick.\r\nhttps://github.com/eerhardt/corefx/commit/38883e3df53153a9434dfc16696667279b18dd82\r\n\r\n@ianhays @stephentoub - Do you guys agree this should be fixed? If so, do you have a preferred option - or an even better option than the 2 I've listed?"},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/156223647","html_url":"https://github.com/dotnet/corefx/issues/4475#issuecomment-156223647","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/4475","id":156223647,"user":{"login":"eerhardt","id":8291187,"avatar_url":"https://avatars.githubusercontent.com/u/8291187?v=3","gravatar_id":"","url":"https://api.github.com/users/eerhardt","html_url":"https://github.com/eerhardt","followers_url":"https://api.github.com/users/eerhardt/followers","following_url":"https://api.github.com/users/eerhardt/following{/other_user}","gists_url":"https://api.github.com/users/eerhardt/gists{/gist_id}","starred_url":"https://api.github.com/users/eerhardt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eerhardt/subscriptions","organizations_url":"https://api.github.com/users/eerhardt/orgs","repos_url":"https://api.github.com/users/eerhardt/repos","events_url":"https://api.github.com/users/eerhardt/events{/privacy}","received_events_url":"https://api.github.com/users/eerhardt/received_events","type":"User","site_admin":false},"created_at":"2015-11-12T20:23:10Z","updated_at":"2015-11-12T20:23:10Z","body":"> If we do set it to Z_BEST_COMPRESSION then we no longer have a good \"middle-ground\" compression level: we can only choose between no compression, fast compression, or best compression.\r\n\r\nDoes that imply that we need a new enum value?"}}