[elbe-devel] [PATCH 2/2] Add zstd in-place packer and tar archiver

Daniel Braunwarth daniel at braunwarth.dev
Fri Jan 7 10:05:32 CET 2022


This patch adds a zstd in-place packer and tar archiver.

The following little benchmarks compares gzip and zstd.
The tests have been run with an example image of 1,9G size.

Compression with gzip which results in a 379M big file:
gzip -f sda2.img  38,78s user 0,71s system 99% cpu 39,529 total

Decompression with gzip:
gunzip sda2.img.gz  8,70s user 0,81s system 97% cpu 9,728 total

Compression with zstd which results in a 353M big file:
zstd -T0 sda2.img  6,66s user 0,65s system 152% cpu 4,791 total

Decompression with zstd:
unzstd sda2.img.zst  1,29s user 0,61s system 48% cpu 3,968 total

Signed-off-by: Daniel Braunwarth <daniel at braunwarth.dev>
---
 debian/control      | 1 +
 elbepack/packers.py | 2 ++
 schema/dbsfed.xsd   | 4 +++-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/debian/control b/debian/control
index 5b4972f57..0594922e6 100644
--- a/debian/control
+++ b/debian/control
@@ -133,6 +133,7 @@ Depends: ${misc:Depends},
   qemu-utils,
   reprepro,
   rsync,
+  zstd,
   kpartx,
   squashfs-tools,
   sudo,
diff --git a/elbepack/packers.py b/elbepack/packers.py
index 7cb876bbf..71957af46 100644
--- a/elbepack/packers.py
+++ b/elbepack/packers.py
@@ -68,9 +68,11 @@ class TarArchiver(Packer):
 
 packers = {'none': NoPacker(),
            'gzip': InPlacePacker('gzip -f', '.gz'),
+           'zstd': InPlacePacker('zstd -T0', '.zst'),
            'tar':  TarArchiver('--auto-compress', '.tar'),
            'tarxz': TarArchiver('--auto-compress', '.tar.xz'),
            'targz': TarArchiver('--auto-compress', '.tar.gz'),
+           'tarzstd': TarArchiver('--use-compress-program="zstd -T0"', '.tar.zst'),
            }
 
 default_packer = packers['targz']
diff --git a/schema/dbsfed.xsd b/schema/dbsfed.xsd
index 440b39e35..820168c38 100644
--- a/schema/dbsfed.xsd
+++ b/schema/dbsfed.xsd
@@ -2412,7 +2412,7 @@
         Set the packer to use for an artifaxct.
 	The value of the tag describes the filename of the Imagefile.
 	The packer attribute may take the following values:
-	(none, gzip, tar, targz, tarxz)
+	(none, gzip, zstd, tar, targz, tarxz, tarzstd)
       </documentation>
     </annotation>
     <simpleContent>
@@ -2426,9 +2426,11 @@
     <restriction base="string">
       <enumeration value="none" />
       <enumeration value="gzip" />
+      <enumeration value="zstd" />
       <enumeration value="tar" />
       <enumeration value="tarxz" />
       <enumeration value="targz" />
+      <enumeration value="tarzstd" />
     </restriction>
   </simpleType>
 
-- 
2.34.1



More information about the elbe-devel mailing list