Article View: linux.kernel.git
Article #2642Re: [PATCH 2/3] t: add "test-tool genbytes" to avoid slow tr(1) on macOS
From: Johannes Sixt
Date: Sun, 08 Nov 2026 08:54
Date: Sun, 08 Nov 2026 08:54
36 lines
8337 bytes
8337 bytes
Am 07.11.26 um 15:59 schrieb Kristofer Karlsson via GitGitGadget: > Several tests create fixture data consisting of a single repeated > character with "test-tool genzeros <count> | tr '\000' <char>". This > works well on platforms where tr(1) is implemented efficiently. > > The implementation of tr(1) on macOS supports multi-byte characters, > and processes its input one character at a time through > getwchar() and putwchar(), even in the C locale. For small inputs > that does not matter, but t4205 generates more than 2GB of data this > way, which makes that test much slower on macOS than on Linux: on the > macOS CI runners, tr(1) alone spends 95 to 123 seconds of CPU time on > it, compared to about 6 seconds on Linux. > > Fix this by adding "test-tool genbytes <byte> [<count>]", which writes > the requested byte directly, and turn "genzeros" into a thin > wrapper around the same code. All cases that do not need a particular character can use printf %0.500d 0 Though, on my Linux box, printf %0.2147483649d 0 produces nothing, but printf 000000000%0.2147483640d 0 has 2147483649 bytes of output. If this isn't insanely slow on macOS, use this pattern instead of a highly engineered helper program? ;-) -- Hannes
Technical Details
Message-ID:
<50b6c35f-e9c3-47ef-8fca-aebd2620623a@kdbg.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74822-linux-kernel-git=dewy.ruReferences:
<pull.2301.git.1794063565.gitgitgadget@gmail.com> <4c02ada9b85028f26f7e7bcc62e2ac12443da9c5.1794063565.git.gitgitgadget@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74822-linux-kernel-git=dewy.ru From: j6t@kdbg.org (Johannes Sixt) Newsgroups: linux.kernel.git Subject: Re: [PATCH 2/3] t: add "test-tool genbytes" to avoid slow tr(1) on macOS Date: Sun, 8 Nov 2026 09:54:23 +0100 Organization: Usenet Network Message-ID: <50b6c35f-e9c3-47ef-8fca-aebd2620623a@kdbg.org> References: <pull.2301.git.1794063565.gitgitgadget@gmail.com> <4c02ada9b85028f26f7e7bcc62e2ac12443da9c5.1794063565.git.gitgitgadget@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="94395"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:XhQwa+56ysjClIvxWzIxNKr4NC8= sha256:/e+o+hYkgfkI1YjVwA/XUu4enr9oxBOs6B6ZosFS0NQ= sha1:rgqORtwABPBHuxMIBWSQjocAO/4= sha256:snWxqNM7+PstIi30OXfPqbTsUeNpYwRql+A/Fz+TXxA= Content-Language: en-US List-ID: <git.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 180FF113538; Sun, 8 Nov 2026 11:54:50 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.951 X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id K1G3FgyztY57; Sun, 8 Nov 2026 11:54:47 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-74822-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=kdbg.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id CB13111352B; Sun, 8 Nov 2026 11:54:42 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 0E65F44386; Sun, 8 Nov 2026 08:54:36 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794128075; b=DTs53Jw5M1B5RoW6MPt9HaI4GrKWxk1284XE6i2IxKcPXBJaZKxTtd2776fK/upkWyvf dOH4sn2S1QE5Xz+BamlsfrtrAu2YTki8xKaRoeHJkkQvnhe3P4BPQgIl7YygQWPjuAv/4 IKOLzHkdK1DwOPUpyaBYH1fllU7IHXU9KVt9khqWJeZcFrgP7+XTYm/oePh7aJvhBcJFZ qk04gFyT+xGnw5vTUmDbzeY4oq6lvs8ZPxqUub94NetrnvXbIQDrRbZyh3z2zLh6WaGz1 8FFdY6QhW/MlzHq/5eRgu3OnL0VSt150Cj7MHpZ6nM7qvGumqcJWJjMq8rXcVYEH3hw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794128075; h=X-Original-To:Received:DMARC-Filter:Received:Message-ID:Date: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=Ru433nnsNfgFBEI1XD/hY0WzuaSIIehrpx6T5HJnOkU=; b=sTkyMYjcVLohbndmftEMpMbu1Qjsv0IdtixZGLQ3B+z/TNNJ3egwJ1vhMgehty2XNcnn USF7+hWsyEfAOZUJVapIj3+SC7S+rkqNtYTPgaKoLrjDyOxO/fsrdwwV+Pf4QHJD0Ua0U R2fb7VtJRmDvUN9A4QVG3UBb9Lk7Yz7f1469O+0+sqvQ4f8AepKDVwL+LUI1m1IGlPOOX tgRruI57nXNgPQKo0YJc4sq4S7p8PcYw592ucR08ecrhGzdQYPuTZpRPxyIxnpWkTEuL+ 0D1JvFfWcgXfUmvZockGcqWi1QRx4rs686mluUGtWAA3J13VuFFmONBeEzzvDMpy5Tw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none header.from=kdbg.org; spf=pass smtp.mailfrom=kdbg.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BFBB0606A31C; Sun, 8 Nov 2026 08:54:35 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=213.33.87.16 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794128075; b=4m/xHLbmWNZCFiW3CRUxqYUNYkYTWTND2shLRvM0gUtdHSOlVLnA7FSndXdJpLAojOzL zVegOtqxKwaQXxBWyt2bdZ+cz375ZwY496+bkIf1BTzlveVav/oX9DifDhjDaRmT/bBDi aQWTq7/K+EeYizJ4NkI1OzV4t9yfsxiPwNx9+Vd8xuj1ev42rhfIk0wFm7TlocIcOyYQw jBIyrYHQWIYEwpfO162sv15f6KS7SbdznONlvPtJPKisRXWkVPoWaVBjc9cX3RJM4Ypur IAuvrBRXLT/6j6nfxNTaPDMwCTkLb0q92c2pVpBkMm9iAH2oeySaDJyJkvxaWV4ibWQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794128075; h=DMARC-Filter:Received:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=Ru433nnsNfgFBEI1XD/hY0WzuaSIIehrpx6T5HJnOkU=; b=Gl62A7z5yzRvgpRM9hFHQqsrS9ZDkfTBgGtMg5KFGAuUDmva+EOh3g7pIp9atxGu5eNi Hmg2zAEWbjlugKLi2auXOb4YgJXEIt+RGyUKQhcvc10NOO1+eGtkzkUj7DXAlaqrGF4HJ b0sIkmwf7sPhqpyI6UF6xPNkUVJBNKRaxXudzyUgXHFGl+bAsxueb/TUcLpBwygFCVjyG pN3y8B/HeSBKZJ0BLNBGnQPhc/a71NCOh41gOqg719FEswKGBrA370IXjxuOWqmGSOkKY cVSDrh7RBCqPzOTs0ToeWyHSqBDM+o7EFk3qIj3pT2nXOrM1678O5DbcmJc/vB3Nygg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=kdbg.org; spf=pass smtp.mailfrom=kdbg.org; arc=none smtp.remote-ip=213.33.87.16 X-Received: from bsmtp2.bon.at (bsmtp2.bon.at [213.33.87.16]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F067606A320 for <git@vger.kernel.org>; Sun, 8 Nov 2026 08:54:34 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3F067606A320 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=kdbg.org X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kdbg.org X-Received: from [192.168.0.102] (unknown [93.83.142.38]) by bsmtp2.bon.at (Postfix) with ESMTPSA id 4jMmtm3L9WzRnlJ; Sun, 8 Nov 2026 09:54:24 +0100 (CET) X-Mailing-List: git@vger.kernel.org X-List-Post: <mailto:git@vger.kernel.org> X-List-Help: <mailto:git+help@vger.kernel.org> X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:git+owner@vger.kernel.org> X-Precedence: list X-User-Agent: Mozilla Thunderbird X-Cc: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org, Kristofer Karlsson via GitGitGadget <gitgitgadget@gmail.com> X-In-Reply-To: <4c02ada9b85028f26f7e7bcc62e2ac12443da9c5.1794063565.git.gitgitgadget@gmail.com>