🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.debian.bugs.dist
Article #3142

Bug#1070168: zstd: Poor performance of Debian build

#3142
From: Richard Oliver
Date: Tue, 03 Nov 2026 13:50
55 lines
4614 bytes
Control: tags -1 + patch
Control: found -1 1.5.7+dfsg-4

Dear Maintainer,

I believe I have found the cause: /usr/bin/zstd is a debug build. During
dh_auto_test, "make test" runs tests/Makefile, which exports DEBUGLEVEL=2 and
rebuilds programs/zstd in place; dh_auto_install then ships that binary.
libzstd1 is not affected.

To confirm:

    grep -c -aF '0<=level && level<=4' /usr/bin/zstd                         # assert()
    grep -c -aF 'ZSTD_compressBlock_internal (dstCapacity=' /usr/bin/zstd   # DEBUGLOG

Both are non-zero on the archive binary and 0 on a release build. With
symbols from debuginfod.debian.net, gdb shows g_debuglevel = 2.

All 1.5.7 builds I checked (-1 and -4, amd64 and arm64) are affected;
bookworm's 1.5.4 and bullseye's 1.4.8 also contain assert() strings.

On arm64 (Raspberry Pi 5, Silesia corpus) the archive binary is 7-25% slower
to compress and 10-13% slower to decompress than a release build of the same
source, which matches the reports above.

The patch below applies to 1.5.7+dfsg-4. Verified on 1.5.7+dfsg-1 with a
full "dpkg-buildpackage -rfakeroot" including tests (all 40 pass); the shipped
binary matches the nocheck build.

--- a/debian/rules
+++ b/debian/rules
@@ -52,6 +52,15 @@
 execute_after_dh_auto_build:
 	dh_auto_build -D contrib/pzstd

+# The upstream test suite rebuilds programs/zstd in place with DEBUGLEVEL=2
+# (assert() and DEBUGLOG enabled), which dh_auto_install would then ship.
+# Keep the release binary aside and put it back once the tests have run.
+execute_before_dh_auto_test:
+	cp -p programs/zstd debian/zstd.release
+
+execute_after_dh_auto_test:
+	cp -p debian/zstd.release programs/zstd
+
 override_dh_auto_install:
 	dh_auto_install -- libdir=/usr/lib/${DEB_HOST_MULTIARCH}
 	dh_auto_install -D contrib/pzstd
--- a/debian/clean
+++ b/debian/clean
@@ -1 +1,2 @@
 tests/cli-tests/bin/symlinks/
+debian/zstd.release

Kind regards,
Richard Oliver
Technical Details
Message-ID: <NVn3H-9C4H-7@gated-at.bofh.it>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
References: <IzerL-afgU-1@gated-at.bofh.it>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.samoylyk.net!gothmog.csi.it!bofh.it!news.nic.it!robomod
From: Richard Oliver <richard.oliver@raspberrypi.com>
Newsgroups: linux.debian.bugs.dist
Subject: Bug#1070168: zstd: Poor performance of Debian build
Date: Tue, 03 Nov 2026 14:50:01 +0100
Message-ID: <NVn3H-9C4H-7@gated-at.bofh.it>
References: <IzerL-afgU-1@gated-at.bofh.it>
X-Original-To: 1070168@bugs.debian.org
X-Mailbox-Line: From debian-bugs-dist-request@lists.debian.org  Tue Nov  3 13:47:07 2026
Old-Return-Path: <debbugs@buxtehude.debian.org>
X-Spam-Flag: NO
X-Spam-Score: -1.45
Reply-To: Richard Oliver <richard.oliver@raspberrypi.com>, 1070168@bugs.debian.org
Resent-To: debian-bugs-dist@lists.debian.org
Resent-Cc: team+pkg-rpm@tracker.debian.org
X-Debian-Pr-Message: followup 1070168
X-Debian-Pr-Package: zstd
X-Debian-Pr-Source: libzstd
X-Gm-Message-State: APuU4Z+R+ezGJnc8rvkR2esZ/+2TJ5JmFLuCjiqy4ySSZ+kA7UhlQXY5
	LQv3KdVtUB/S/nGwd8zQjdgwK0S4R2zu4x/eHiZ1WBnYGTf3vBkImckHHMNoN5RiORboI8P1aMa
	bXr1K
X-Gm-Gg: AYBFou0TWqoUYCLh15eNHatUQsChMLcPjDOExdobJnDmnyL9kdgIxLbeiufQePZ2H+P
	Hk6IWIxurO1lU6YtPts/YLHE9nBJ0qI+EgVd1PfQWOWaanLq7cZLfYw3npQrIlzavBSEiMcyxgq
	f1z+/RT0NnwE2tSU0XgSpwV6nMZVowFP/LnmkW8muqzAly2KrW6ppFyVXkBpecGCuei1naIR7uh
	AwYPgS4CreLwmNpHnu04XnHHBxaIuDWKbhRgMsQsmHEg87jSd2kA6RM7NCOFLhQRCh/hBcQjPSD
	bvkcEz2NQGRK+DYTVIOMOOu6e3Gs9ZLqRVAlfyZipsO23hQNWmeTIQ4qSCQBQ48BZ+9IFhess41
	124hu+UWjHvEC0T1Q0nRs7mn8lu3/iI6W/H/g0aX4GZYqsR0ZC+THaVx4VGC+IRsrfJ94c6o3Vt
	aNuDBb82ZMUsamQJjrzcS2mLjaRayYued6qy1q50LuEWBL+Z9QIXnx32nAvpNMmW5rjFKaKNmxL
	d6dqhDCTFXOdHAzXoC3OodIAvH6I+l4yS5MbN59WfmpZOV9gWA35fJXHsVcJYIbm8cAFFuCJfi5
	JWhA3ks+8LGU37Nkta45oYcjWg82vWBixuztzLhP
X-Received: by 2002:a05:600c:a4c:b0:4a2:967:dfb8 with SMTP id 5b1f17b1804b1-4ac1765d7d7mr302644735e9.20.1793713536463;
        Tue, 03 Nov 2026 05:45:36 -0800 (PST)
Content-Type: text/plain; charset=utf-8
X-Debian-Message: from BTS
X-Mailing-List: <debian-bugs-dist@lists.debian.org> archive/latest/2000432
List-ID: <debian-bugs-dist.lists.debian.org>
List-URL: <https://lists.debian.org/debian-bugs-dist/>
Approved: robomod@news.nic.it
Lines: 55
Organization: linux.* mail to news gateway
Sender: robomod@news.nic.it
X-Original-Cc: Richard Oliver <richard.oliver@raspberrypi.com>
X-Original-Date: Tue, 03 Nov 2026 13:45:34 +0000
X-Original-Message-ID: <b9b6b9442d5886f0c64d399032a39d2a@raspberrypi.com>
X-Original-References: <1088752f-df1c-4837-b59e-3f238dc5ba92@laposte.net>