Skip to content

Commit

Permalink
Reduce raw block allocs (#258)
Browse files Browse the repository at this point in the history
* Reduce raw blocks allocations

When decoding raw blocks they are passed straight through anyway, so there is no need for a destination buffer.
  • Loading branch information
klauspost authored May 21, 2020
1 parent b81237a commit ece7104
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion zstd/blockdec.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,12 @@ func (b *blockDec) reset(br byteBuffer, windowSize uint64) error {
}
return ErrCompressedSizeTooBig
}
default:
case blockTypeRaw:
b.RLESize = 0
// We do not need a destination for raw blocks.
maxSize = -1
default:
panic("Invalid block type")
}

// Read block data.
Expand Down

0 comments on commit ece7104

Please sign in to comment.