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 b3319f0 commit ae8836f
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 @@ -220,6 +220,12 @@ func DecompressStream(archive io.Reader) (_ io.ReadCloser, Err 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:
return nil, fmt.Errorf("unsupported compression format %s", (&compression).Extension())
Expand Down

0 comments on commit ae8836f

Please sign in to comment.