Skip to content

Commit

Permalink
zstd: Use configured block size (#605)
Browse files Browse the repository at this point in the history
Single blocks up to max block size would be created with EncodeAll, if src was smaller. This uses the configured max block size.

Block size is max for settings >= default, so no change for these.
  • Loading branch information
klauspost authored May 30, 2022
1 parent dab79ca commit 6c3cad3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zstd/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ func (e *Encoder) EncodeAll(src, dst []byte) []byte {
}

// If we can do everything in one block, prefer that.
if len(src) <= maxCompressedBlockSize {
if len(src) <= e.o.blockSize {
enc.Reset(e.o.dict, true)
// Slightly faster with no history and everything in one block.
if e.o.crc {
Expand Down

0 comments on commit 6c3cad3

Please sign in to comment.