Git development
 help / color / mirror / Atom feed
* [PATCH 0/3] t: add "test-tool genbytes" to avoid slow tr(1) on macOS
@ 2026-11-07 14:59 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
                   ` (7 more replies)
  0 siblings, 8 replies; 39+ messages in thread
From: Kristofer Karlsson via GitGitGadget @ 2026-11-07 14:59 UTC (permalink / raw)
  To: git; +Cc: Patrick Steinhardt, Kristofer Karlsson

While looking for slow tests in CI, t4205 stood out on macOS: its EXPENSIVE
tests take several times longer there than on Linux. A CI experiment showed
that much of the time was spent in tr(1), which is very slow on macOS for
the 2GB of data that t4205 generates.

Patch 1 renames test-genzeros.c so that the actual changes in patch 2 show
up as a regular diff. Patch 2 adds "genbytes" and uses it instead of
"genzeros | tr", which is where the speedup comes from.

Open question: is patch 3 wanted? It folds "genzeros" into "genbytes",
spelling the NUL byte as "NUL", so that there is a single command.
Alternatively, we could drop it and keep "genzeros" as a thin wrapper,
avoiding changes to its 10 call sites. I kept patch 3 separate so that it is
easy to drop, but it could also be squashed into patch 2.

Some other decisions that may be worth pointing out:

 * The buffer is no longer static: it used to be static so that it was
   zero-initialized for free, but now that it is filled with the requested
   byte on every call, a local buffer avoids shared state. It keeps its size
   of 256KB. Smaller buffers made no measurable difference in my tests, but
   there was no reason to change it.

 * Invalid counts are still silently treated as 0, as before. That could be
   tightened, but it is unrelated to this series.

Kristofer Karlsson (3):
  t/helper: rename test-genzeros.c to test-genbytes.c
  t: add "test-tool genbytes" to avoid slow tr(1) on macOS
  t: replace "test-tool genzeros" with "genbytes NUL"

 Makefile                          |  2 +-
 t/helper/meson.build              |  2 +-
 t/helper/test-genbytes.c          | 64 +++++++++++++++++++++++++++++++
 t/helper/test-genzeros.c          | 37 ------------------
 t/helper/test-tool.c              |  2 +-
 t/helper/test-tool.h              |  2 +-
 t/t0613-reftable-write-options.sh |  2 +-
 t/t1007-hash-object.sh            |  8 ++--
 t/t1051-large-conversion.sh       |  4 +-
 t/t1450-fsck.sh                   |  4 +-
 t/t4141-apply-too-large.sh        |  2 +-
 t/t4205-log-pretty-formats.sh     |  2 +-
 t/t5300-pack-object.sh            |  6 +--
 t/t5318-commit-graph.sh           |  2 +-
 t/t7006-pager.sh                  |  3 +-
 t/t9850-shell.sh                  |  2 +-
 16 files changed, 85 insertions(+), 59 deletions(-)
 create mode 100644 t/helper/test-genbytes.c
 delete mode 100644 t/helper/test-genzeros.c


base-commit: fb255012acbcbe81189cb8014da0280b09c66ecc
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-2301%2Fspkrka%2Ftest-tool-genbytes-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2301/spkrka/test-tool-genbytes-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/2301
-- 
gitgitgadget

^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2026-11-11 17:57 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox