-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compression: add support for the zstd algorithm
zstd is a compression algorithm that has a very fast decoder, while providing also good compression ratios. The fast decoder makes it suitable for container images, as decompressing the tarballs is a very expensive operation. This is a first step at supporting zstd as we We don't yet generate zstd layers. In my testing, copying the Fedora image from a local dir: repository, the wall clock time passed from ~8s with gzip compression to ~4.5s with zstd. Signed-off-by: Giuseppe Scrivano <[email protected]>
- Loading branch information
Showing
34 changed files
with
12,502 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// +build cgo | ||
|
||
package archive | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/DataDog/zstd" | ||
) | ||
|
||
func zstdReader(buf io.Reader) (io.ReadCloser, error) { | ||
return zstd.NewReader(buf), nil | ||
} | ||
|
||
func zstdWriter(dest io.Writer) (io.WriteCloser, error) { | ||
return zstd.NewWriter(dest), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// +build !cgo | ||
|
||
package archive | ||
|
||
import ( | ||
"fmt" | ||
"io" | ||
) | ||
|
||
func zstdReader(buf io.Reader) (io.ReadCloser, error) { | ||
return nil, fmt.Errorf("zstd not supported on this platform") | ||
} | ||
|
||
func zstdWriter(dest io.Writer) (io.WriteCloser, error) { | ||
return nil, fmt.Errorf("zstd not supported on this platform") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.