commit: 751feadfc97be72faf5ad050f72093061377642d
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 28 14:52:18 2025 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Aug 28 14:52:18 2025 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=751feadf
q: use zstd level 19 for compressing a gtree
unfortunately it seems libarchive upstream is not willing to allow
setting Zstd compression level (or the level for any other compressor),
so we have to manually call zstd client program to get better
compression.
For rationale, compressing the tree results in:
compress read
zstd3: 32.9MiB 8s 0.13s
zstd9: 29.1MiB 12s 0.13s
zstd19: 25.4MiB 22s 0.12s
So, while the compression time goes up (it's still a lot less than xz),
we save a few MiBs (getting almost the to xz's size), while
decompression gets even faster (and nowhere near the twice as slow
reading times for xz).
Issue: https://github.com/libarchive/libarchive/issues/957
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
q.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/q.c b/q.c
index 5335b07..8ae5b3c 100644
--- a/q.c
+++ b/q.c
@@ -854,7 +854,12 @@ int q_main(int argc, char **argv)
qcctx.archive = archive_write_new();
archive_write_set_format_ustar(qcctx.archive);
- archive_write_add_filter_zstd(qcctx.archive);
+ /* would love to use this:
+ * archive_write_add_filter_zstd(qcctx.archive);
+ * but
https://github.com/libarchive/libarchive/issues/957
+ * suggests there's never going to get to be an
interface
+ * for this, which is a real shame */
+ archive_write_add_filter_program(qcctx.archive, "zstd
-19");
archive_write_open_fd(qcctx.archive, tfd);
/* write repo name, if any */