Avoid unnecessary copying with filters.
fancycode opened this issue · comments
Joachim Bauch commented
The filters usually return a *bytes.Buffer
, so copying it into a temporary bytes.Buffer
to get the underlying []byte
can be avoided.
Example:
pdfcpu/pkg/pdfcpu/types/streamdict.go
Lines 292 to 297 in fc87a22
Same applies for the filters itself which can be chained and in such casees also don't need to copy from the passed io.Reader
if it is actually a *bytes.Buffer
.