Article View: linux.kernel.git
Article #2724Re: [PATCH 2/3] t: add "test-tool genbytes" to avoid slow tr(1) on macOS
From: Johannes Sixt
Date: Mon, 09 Nov 2026 15:38
Date: Mon, 09 Nov 2026 15:38
34 lines
8864 bytes
8864 bytes
Am 09.11.26 um 14:05 schrieb Kristofer Karlsson:
> On Mon, 9 Nov 2026 at 10:33, Johannes Sixt <j6t@kdbg.org> wrote:
>> test_expect_success EXPENSIVE,SIZE_T_IS_64BIT 'set up huge commit' '
>> - test-tool genzeros 2147483649 | tr "\000" "1" >expect &&
>> + # 3 * 715827883 == 2147483649
>> + printf %0715827883d 0 0 0 >expect &&
>> huge_commit=$(git commit-tree -F expect HEAD^{tree})
>
> I tested this and it passes on all the macOS jobs. t4205 goes
> from 800-900s to 170-280s there, so your idea works well.
>
> Two caveats: the printf builtin in bash 3.2 (/bin/sh on macOS)
> silently prints nothing for a field wider than INT_MAX - 15,
> and it builds each field in memory, so this peaks at about 2.1GB
> RSS. Both go away by writing in 1MiB chunks, at the same speed:
>
> gen_ascii_zeros () {
> _n=$1
> while test "$_n" -gt 0
> do
> _chunk=$(( _n > 1048576 ? 1048576 : _n ))
> printf "%0${_chunk}d" 0 || return 1
> _n=$(( _n - _chunk ))
> done
> }
I wouldn't do that (and pay the memory price instead), because the next
shell doesn't have printf as a builtin and spawns 2000 printf processes.
Now let's stop painting bikeshes. I'd be fine with your previous
suggestion to have both `test-tool genzeros` and `test-tool genbytes`.
-- Hannes
Technical Details
Message-ID:
<7b2e7ddf-dc8b-4538-b736-92217e20c8f0@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-74942-linux-kernel-git=dewy.ruReferences:
<pull.2301.git.1794063565.gitgitgadget@gmail.com> <4c02ada9b85028f26f7e7bcc62e2ac12443da9c5.1794063565.git.gitgitgadget@gmail.com> <50b6c35f-e9c3-47ef-8fca-aebd2620623a@kdbg.org> <CAL71e4NFyAShDZPW9JRB7Bpg3aLY5mY4wdn5m_ZYoLQjHZw_jA@mail.gmail.com> <6992b7e9-8721-4e1f-9c00-9fd0e0704e80@kdbg.org> <CAL71e4NKsTZNoLFOuSPfiJPf7oS57S01MpM5V+UOr+bgMGjOkQ@mail.gmail.com> <c8688e1a-17b6-4d0b-ba9a-fc1e0fa8938b@kdbg.org> <ddea802a-d4f4-4de9-9108-e68201841bc4@kdbg.org> <CAL71e4PSOJgKFfBLrTXJSAewnZTJpNEiAMC-_FbW_9cmpEvLmg@mail.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-74942-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: Mon, 9 Nov 2026 16:38:48 +0100 Organization: Usenet Network Message-ID: <7b2e7ddf-dc8b-4538-b736-92217e20c8f0@kdbg.org> References: <pull.2301.git.1794063565.gitgitgadget@gmail.com> <4c02ada9b85028f26f7e7bcc62e2ac12443da9c5.1794063565.git.gitgitgadget@gmail.com> <50b6c35f-e9c3-47ef-8fca-aebd2620623a@kdbg.org> <CAL71e4NFyAShDZPW9JRB7Bpg3aLY5mY4wdn5m_ZYoLQjHZw_jA@mail.gmail.com> <6992b7e9-8721-4e1f-9c00-9fd0e0704e80@kdbg.org> <CAL71e4NKsTZNoLFOuSPfiJPf7oS57S01MpM5V+UOr+bgMGjOkQ@mail.gmail.com> <c8688e1a-17b6-4d0b-ba9a-fc1e0fa8938b@kdbg.org> <ddea802a-d4f4-4de9-9108-e68201841bc4@kdbg.org> <CAL71e4PSOJgKFfBLrTXJSAewnZTJpNEiAMC-_FbW_9cmpEvLmg@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="390339"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:XcoD3Y7+c7K6fCQxWMJiYWYZwN0= sha256:DhNpRR3/LudP2R+Puzao8odVNkgKX5GYOHq0A9DDZIc= sha1:Xuu3+8o2plRi9WfFz6sFSlVAqbo= sha256:CLpT9Rh947ylhwKQSpHNk2TWUNYz074lkjv4i6LZCtA= 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 A2440113856; Mon, 9 Nov 2026 18:42:52 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -1.851 X-Spam-Status: No, score=-1.851 tagged_above=-9999 required=6.31 tests=[DCC_CHECK=1.1, 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 Sw-RhZfOdmXO; Mon, 9 Nov 2026 18:42:49 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-74942-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 389D8113847; Mon, 9 Nov 2026 18:42:45 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 3D629C14CA; Mon, 9 Nov 2026 15:38:59 +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=1794238739; b=ipGB7kCZzT66LOyajJnfLZfoNhTcVUZNVrRVtQJa9AuY0icdmGACiJC0yMpy1Xa7SFQ8 IJ4nqfRkPheQSDVlJFLK/3B5PdOMwKWTkCJy24ZeFM5bAOyxvekRzT8LC6/7aOp6oUYKZ e0/QxM3V0F/6wbwdTy2Us+QkHf6lkFt1jmsSekVrlr4cFJSR3UhYTMeBZi2ATO0+ax/c7 xCPKS44SvEhd+qHYjUQ/Cv3uXi8c71NC/pIDFpoMIxPeGbJ3l8RzR1jUharOcbg4Mh1+D RNCflFz+YCGXIgYElJY4f20Puaqu7dQGleWR+74B1AkWdNMtORlb6f7WabhfZ4t0kPA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794238739; 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:Content-Language:To:Cc:References:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=esLX6nFjB702RdkIXmwF83l3XY0qqKCp+0Od6rfLsUA=; b=ogmb0r3GPP+aLhGYoF5gmbd5EZdjR/w8JEplVO/aw+QJgNBou7I49EbfzcYS3HIeE8s2 O7SHjBFSy+hM1kXENXek7H042AepIkZf9N+BU7pA2sts9ItiUWZnSZ20zt7ayWBDaFOBK K1f0itdiorjP32SIu7Sp5fivnbIAqWs29VFPAE/B7RBxa92MUq1nffmCXhnkijZnKkz1Q 4OMZF0KURuy/lBVgx8NlpQnCCcXGUBxH3Dh5I/c65eAJ1UU7IlFsRXzoZa9DAlJ/91NEp Xp3D139rGnCXIpunMGivgjxeMR3Y9aD6gfPkzfRd3/XjYRbodzVSQ+aJTMHG3IfSlnA== 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 1F2CD606A325; Mon, 9 Nov 2026 15:38:59 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=213.33.87.15 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794238738; b=cLmdEk3ROeoQ4kuzVmtSd0aGuUeS0NoMC1lTgHDjcUHxKIwGK47EJLGOZAtpvrpxOmnU bRwwS0U7SI+38yGmw8mlWaavr9QjQYPKmX8IhvX14q9M/7tX4wW9SIKXKD0Jk6GcFuxTU koFEeITsI0RPPv69I6ouUUjpYDjG4CkyEYkg09ZtoJ1HjwFKeSlm1uwAS+ket+uvramNO 46Jc81S3nbygVZed7KcXb66WMTEbYYUZpRHNwap7npW4/EQoaqBNUd4fooBBqn5JsiicR 1VlFgkUj3y+cyVeT/tMw5pUzRJyrqFLAhqZ9inISDjjiIo8F1Fm82gLeBRtUdH7q7Yw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794238738; h=DMARC-Filter:Received:Message-ID:Date:MIME-Version:User-Agent: Subject:Content-Language:To:Cc:References:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=esLX6nFjB702RdkIXmwF83l3XY0qqKCp+0Od6rfLsUA=; b=Uk92ykWUfnBZd0j0XDH+0WjE4YG2isynOeXF2W9/h3JQggA17GrlFdX9/8UL8NUrClu/ z2K87kuVYZSkRcYHsSnAmOUGbYgNy/XMHwx0XCav7SyhMH73116FcyHwp65Fg2SWB7acc udsKFZyvADu6i76GyWLY4Z1TPXfeMw+isTLoTiSvK+nAQjw3XXrpWbSjgJgtWWTU1K+Hy owamZzq6dhYTaqkxLasTRyi345F91N260/tYyRfpvFjsy2afNmxjInBXaFAcrQNMs9ogw aDmYykIU5O/5555YzbZxVXmUKiUT1qtOyPiRsZmmoaAQDxzYhfh/YSVX4glz+108sJA== 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.15 X-Received: from bsmtp1.bon.at (bsmtp1.bon.at [213.33.87.15]) (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 BDA94606A326 for <git@vger.kernel.org>; Mon, 9 Nov 2026 15:38:57 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BDA94606A326 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 bsmtp1.bon.at (Postfix) with ESMTPSA id 4jNYpx16VNzRpL8; Mon, 9 Nov 2026 16:38:49 +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: <CAL71e4PSOJgKFfBLrTXJSAewnZTJpNEiAMC-_FbW_9cmpEvLmg@mail.gmail.com>