Git development
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Kristofer Karlsson <krka@spotify.com>
Cc: Patrick Steinhardt <ps@pks.im>,
	git@vger.kernel.org,
	Kristofer Karlsson via GitGitGadget <gitgitgadget@gmail.com>
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	[thread overview]
Message-ID: <50b6c35f-e9c3-47ef-8fca-aebd2620623a@kdbg.org> (raw)
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 <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


  reply	other threads:[~2026-11-08  8:54 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07 14:59 [PATCH 0/3] t: add "test-tool genbytes" to avoid slow tr(1) on macOS Kristofer Karlsson via GitGitGadget
2026-11-07 14:59 ` [PATCH 1/3] t/helper: rename test-genzeros.c to test-genbytes.c Kristofer Karlsson via GitGitGadget
2026-11-07 23:15   ` Junio C Hamano
2026-11-08  4:44     ` Junio C Hamano
2026-11-08  9:10       ` Kristofer Karlsson
2026-11-08 18:35         ` Junio C Hamano
2026-11-08 19:10           ` Kristofer Karlsson
2026-11-07 14:59 ` [PATCH 2/3] t: add "test-tool genbytes" to avoid slow tr(1) on macOS Kristofer Karlsson via GitGitGadget
2026-11-08  8:54   ` Johannes Sixt [this message]
2026-11-08  9:18     ` Kristofer Karlsson
2026-11-08  9:35       ` Johannes Sixt
2026-11-08 12:24         ` Kristofer Karlsson
2026-11-08 16:34           ` Johannes Sixt
2026-11-09  9:33             ` Johannes Sixt
2026-11-09 13:05               ` Kristofer Karlsson
2026-11-09 15:38                 ` Johannes Sixt
2026-11-10  6:00       ` Collin Funk
2026-11-10  8:09         ` Kristofer Karlsson
2026-11-08 18:37     ` Junio C Hamano
2026-11-07 14:59 ` [PATCH 3/3] t: replace "test-tool genzeros" with "genbytes NUL" Kristofer Karlsson via GitGitGadget
2026-11-07 23:04 ` [PATCH 0/3] t: add "test-tool genbytes" to avoid slow tr(1) on macOS Junio C Hamano
2026-11-08  9:11   ` Kristofer Karlsson
2026-11-07 23:23 ` Junio C Hamano
2026-11-08  9:13   ` Kristofer Karlsson
2026-11-08 19:15 ` [PATCH v2 0/2] " Kristofer Karlsson via GitGitGadget
2026-11-08 19:15   ` [PATCH v2 1/2] " Kristofer Karlsson via GitGitGadget
2026-11-09  1:39     ` Junio C Hamano
2026-11-09  7:10       ` Kristofer Karlsson
2026-11-09 15:41         ` Junio C Hamano
2026-11-09  6:59     ` Patrick Steinhardt
2026-11-09  7:43       ` Kristofer Karlsson
2026-11-08 19:15   ` [PATCH v2 2/2] t: replace "test-tool genzeros" with "genbytes 00" Kristofer Karlsson via GitGitGadget
2026-11-10 18:26 ` [PATCH v3] t: add "test-tool genbytes" to avoid slow tr(1) on macOS Kristofer Karlsson via GitGitGadget
2026-11-10 19:31   ` Junio C Hamano
2026-11-11 10:54   ` Patrick Steinhardt
2026-11-11 15:38   ` Junio C Hamano
2026-11-11 15:47     ` Kristofer Karlsson
2026-11-11 17:57       ` Junio C Hamano
2026-11-11 15:59 ` [PATCH v4] " Kristofer Karlsson via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50b6c35f-e9c3-47ef-8fca-aebd2620623a@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=krka@spotify.com \
    --cc=ps@pks.im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox