home: hub: mkinitfs

Download patch

ref: 745190d00e424a052a2c68b26951424524b5eb40
parent: bdf957c4f01c739d86ff86be013d94a17990b123
author: psykose <alice@ayaya.dev>
date: Sun Jan 8 02:28:46 CST 2023

mkinitfs: add threaded zstd compression

-T0 defaults to hardware cores (no SMT cores, so 8 on a 8core/16thread
cpu)

for something small like the initrd, so many threads can't be utilised
anyway, so generally this will only use a few (3-4). it does make it
take much less time, however

$ zstd -b19 out
19#out : 86131024 ->  22705519 (x3.793), 6.05 MB/s, 1395.7 MB/s
$ zstd -T0 -b19 out
19#out : 86131024 ->  22636531 (x3.805), 15.4 MB/s, 1394.2 MB/s

--- a/mkinitfs.in
+++ b/mkinitfs.in
@@ -300,7 +300,7 @@
 case "$initfscomp" in
 	gzip) comp="$(command -v pigz 2>/dev/null || echo gzip) -9" ;;
 	xz) cmd_exists xz; comp="xz -C crc32 -T 0" ;;
-	zstd) cmd_exists zstd; comp="zstd -19" ;;
+	zstd) cmd_exists zstd; comp="zstd -T0 -19" ;;
 	lz4) cmd_exists lz4; comp="lz4 --favor-decSpeed --best -lz" ;;
 	none) comp="cat";;
 	*) echo "Initramfs compression \"$initfscomp\" not supported!"; exit 1 ;;