Skip to content

Commit

Permalink
archive: use zstd if available
Browse files Browse the repository at this point in the history
the performance improvement is not as clear as with pigz, but it is
still measurable difference.

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Jun 11, 2024
1 parent e663069 commit c283dd9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,12 @@ func DecompressStream(archive io.Reader) (io.ReadCloser, error) {
readBufWrapper := p.NewReadCloserWrapper(buf, xzReader)
return readBufWrapper, nil
case Zstd:
cleanup := func() {
p.Put(buf)
}
if rc, canUse := tryProcFilter([]string{"zstd", "-d"}, buf, cleanup); canUse {
return rc, nil
}
return zstdReader(buf)
default:
p.Put(buf)
Expand Down

0 comments on commit c283dd9

Please sign in to comment.