git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/3] t: add "test-tool genbytes" to avoid slow tr(1) on macOS

From
Johannes Sixt <j6t@kdbg.org>
Date
Nov 8, 2026, 08:54 UTC
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:
Show 15 quoted lines
> 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
Previous: Kristofer Karlsson via GitGitGadgetNext: Kristofer Karlsson
Message 9 of 39 in “t: add "test-tool genbytes" to avoid slow tr(1) on macOS”
  1. 0/3 t: add "test-tool genbytes" to avoid slow tr(1) on macOSKristofer Karlsson via GitGitGadget, Nov 7, 2026
  2. 1/3 t/helper: rename test-genzeros.c to test-genbytes.cKristofer Karlsson via GitGitGadget, Nov 7, 2026
  3. Junio C HamanoNov 7, 2026
  4. Junio C HamanoNov 8, 2026
  5. Kristofer KarlssonNov 8, 2026
  6. Junio C HamanoNov 8, 2026
  7. Kristofer KarlssonNov 8, 2026
  8. 2/3 t: add "test-tool genbytes" to avoid slow tr(1) on macOSKristofer Karlsson via GitGitGadget, Nov 7, 2026
  9. Johannes SixtNov 8, 2026
  10. Kristofer KarlssonNov 8, 2026
  11. Johannes SixtNov 8, 2026
  12. Kristofer KarlssonNov 8, 2026
  13. Johannes SixtNov 8, 2026
  14. Johannes SixtNov 9, 2026
  15. Kristofer KarlssonNov 9, 2026
  16. Johannes SixtNov 9, 2026
  17. Collin FunkNov 10, 2026
  18. Kristofer KarlssonNov 10, 2026
  19. Junio C HamanoNov 8, 2026
  20. 3/3 t: replace "test-tool genzeros" with "genbytes NUL"Kristofer Karlsson via GitGitGadget, Nov 7, 2026
  21. Junio C HamanoNov 7, 2026
  22. Kristofer KarlssonNov 8, 2026
  23. Junio C HamanoNov 7, 2026
  24. Kristofer KarlssonNov 8, 2026
  25. 0/2 t: add "test-tool genbytes" to avoid slow tr(1) on macOSKristofer Karlsson via GitGitGadget, Nov 8, 2026
  26. 1/2 t: add "test-tool genbytes" to avoid slow tr(1) on macOSKristofer Karlsson via GitGitGadget, Nov 8, 2026
  27. Junio C HamanoNov 9, 2026
  28. Kristofer KarlssonNov 9, 2026
  29. Junio C HamanoNov 9, 2026
  30. Patrick SteinhardtNov 9, 2026
  31. Kristofer KarlssonNov 9, 2026
  32. 2/2 t: replace "test-tool genzeros" with "genbytes 00"Kristofer Karlsson via GitGitGadget, Nov 8, 2026
  33. t: add "test-tool genbytes" to avoid slow tr(1) on macOSKristofer Karlsson via GitGitGadget, Nov 10, 2026
  34. Junio C HamanoNov 10, 2026
  35. Patrick SteinhardtNov 11, 2026
  36. Junio C HamanoNov 11, 2026
  37. Kristofer KarlssonNov 11, 2026
  38. Junio C HamanoNov 11, 2026
  39. t: add "test-tool genbytes" to avoid slow tr(1) on macOSKristofer Karlsson via GitGitGadget, Nov 11, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.