From 01b2a79f9e8fdaeda055d7e9c19c6d45b677ba12 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Wed, 24 Jan 2024 01:41:10 -0800 Subject: [PATCH] zstd: Limit default window to 8MB (#913) Limit the default window size to 8MB. --- zstd/encoder_options.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zstd/encoder_options.go b/zstd/encoder_options.go index faaf81921c..20671dcb91 100644 --- a/zstd/encoder_options.go +++ b/zstd/encoder_options.go @@ -94,7 +94,7 @@ func WithEncoderConcurrency(n int) EOption { // The value must be a power of two between MinWindowSize and MaxWindowSize. // A larger value will enable better compression but allocate more memory and, // for above-default values, take considerably longer. -// The default value is determined by the compression level. +// The default value is determined by the compression level and max 8MB. func WithWindowSize(n int) EOption { return func(o *encoderOptions) error { switch { @@ -232,9 +232,9 @@ func WithEncoderLevel(l EncoderLevel) EOption { case SpeedDefault: o.windowSize = 8 << 20 case SpeedBetterCompression: - o.windowSize = 16 << 20 + o.windowSize = 8 << 20 case SpeedBestCompression: - o.windowSize = 32 << 20 + o.windowSize = 8 << 20 } } if !o.customALEntropy {