Skip to content

zstd: support c based implementation #2345

@tonistiigi

Description

@tonistiigi

follow up #2344

Cgo based implementations should be faster and also use standard compression levels. As dockerfile supports c cross-compiling, supporting cgo is not a problem.

There seems to be two libraries:

  • https://github.com/DataDog/zstd
    Tested this internally and the master version seemed to work fine. I don't like that it is making a copy of upstream source code though.

  • https://github.com/valyala/gozstd
    Seems like a cleaner implementation but for some bizarre reason that repo vendors prebuilt static libs inside the source code for all arch 🤦 . So that definitely would not work for our vendoring and our platform support is bigger anyway. Looks like if we were to use it we would need to create a mirror without the binary artifacts.

The differ side can be implemented only on buildkit side. The apply side is hardcoded in contained and needs a Compressor opt in ApplyOpt same way as was added on the differ side to support stargz.

Another option would be to shell out to zstd binary like we do for pigz. I have not benchmarked this and likely something like zstd:chunked should still be using golang implementation then.

@ktock

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions