Skip to content

Commit

Permalink
zstd: Limit default window to 8MB (#913)
Browse files Browse the repository at this point in the history
Limit the default window size to 8MB.
  • Loading branch information
klauspost committed Jan 24, 2024
1 parent 32312d5 commit 01b2a79
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions zstd/encoder_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 01b2a79

Please sign in to comment.