aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorDaniel Edgecumbe <git@esotericnonsense.com>2019-09-02 22:09:15 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2019-09-05 13:26:58 +0200
commitc660cc1b7714fffbac95c9378ff4b73de650a6de (patch)
treee05f4421fc7f0e5c6b9bf39e1e45fbdaedc80769 /archival
parentca5d86d52c979cef05a614fb725870c10be9b265 (diff)
downloadbusybox-c660cc1b7714fffbac95c9378ff4b73de650a6de.tar.gz
gzip: set default compression level to 6 when CONFIG_FEATURE_GZIP_LEVELS=n
With this change, GNU gzip -n and BusyBox gzip now produce identical output assuming that CONFIG_GZIP_FAST=2. >> Excuse me, but I wonder one thing: Why should we follow >> strictly with gzip on the no-options default behavior? > First, the default 6 compression level is a de-facto standard. BSD gzip > and Apple gzip (on macOS) use this default as well. So there is a > reasonable expectation that different gzip implementations act the same. > For instance, if the default for busybox gzip becomes 9, then someone > writing a script using busybox gzip could reasonably expect that the > compression level will still be 9 when the same script is run on another > system. That would be wrong. Implementations should not deviate from > de-facto standards without a strong reason. > > Second, the inherent reason for this default has not gone away. While > processor speeds have exploded since the default was set, so has the > typical size of compressed files. Multiple gigabytes are nothing unusual > these days. And gzip is often used for compression on the fly, precisely > because it offers a good compromise between speed and compression ratio. > So I believe 6 continues to be a reasonable default. function old new delta deflate 939 927 -12 Signed-off-by: Daniel Edgecumbe <git@esotericnonsense.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival')
-rw-r--r--archival/gzip.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/archival/gzip.c b/archival/gzip.c
index a543d8c36..b08e60efd 100644
--- a/archival/gzip.c
+++ b/archival/gzip.c
@@ -52,7 +52,7 @@ aa: 85.1% -- replaced with aa.gz
//config: help
//config: Enable support for compression levels 4-9. The default level
//config: is 6. If levels 1-3 are specified, 4 is used.
-//config: If this option is not selected, -N options are ignored and -9
+//config: If this option is not selected, -N options are ignored and -6
//config: is used.
//config:
//config:config FEATURE_GZIP_DECOMPRESS
@@ -259,13 +259,13 @@ enum {
#if !ENABLE_FEATURE_GZIP_LEVELS
- comp_level = 9,
- max_chain_length = 4096,
+ comp_level = 6,
+ max_chain_length = 128,
/* To speed up deflation, hash chains are never searched beyond this length.
* A higher limit improves compression ratio but degrades the speed.
*/
- max_lazy_match = 258,
+ max_lazy_match = 16,
/* Attempt to find a better match only when the current match is strictly
* smaller than this value. This mechanism is used only for compression
* levels >= 4.
@@ -277,7 +277,7 @@ enum {
* max_insert_length is used only for compression levels <= 3.
*/
- good_match = 32,
+ good_match = 8,
/* Use a faster search when the previous match is longer than this */
/* Values for max_lazy_match, good_match and max_chain_length, depending on
@@ -286,7 +286,7 @@ enum {
* found for specific files.
*/
- nice_match = 258, /* Stop searching when current match exceeds this */
+ nice_match = 128, /* Stop searching when current match exceeds this */
/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4
* For deflate_fast() (levels <= 3) good is ignored and lazy has a different
* meaning.