From: Johannes Sixt Date: Sun, 08 Nov 2026 08:54:23 GMT Subject: Re: [PATCH 2/3] t: add "test-tool genbytes" to avoid slow tr(1) on macOS Message-ID: <50b6c35f-e9c3-47ef-8fca-aebd2620623a@kdbg.org> In-Reply-To: <4c02ada9b85028f26f7e7bcc62e2ac12443da9c5.1794063565.git.gitgitgadget@gmail.com> 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 | tr '\000' ". 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 []", 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