Skip to content

pr-2301/spkrka/test-tool-genbytes-v2

tagged this 08 Nov 19:15
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 adds "test-tool genbytes" and uses it instead of "genzeros | tr",
which is where the speedup comes from. Patch 2 converts the remaining
"genzeros" callers and removes it.

Changes since v1:

 * Squashed the rename of test-genzeros.c into the patch that changes it, as
   suggested by Junio. The file changes enough that the default rename
   detection shows it as deleted and newly created; "git format-patch -M30%"
   shows it as a rename.

 * "genbytes" now takes the byte as two lowercase hexadecimal digits instead
   of a literal character, as suggested by Junio. This also works for NUL
   bytes, so patch 2 now uses "genbytes 00" instead of special-casing "NUL".

Kristofer Karlsson (2):
  t: add "test-tool genbytes" to avoid slow tr(1) on macOS
  t: replace "test-tool genzeros" with "genbytes 00"

 Makefile                          |  2 +-
 t/helper/meson.build              |  2 +-
 t/helper/test-genbytes.c          | 51 +++++++++++++++++++++++++++++++
 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, 72 insertions(+), 59 deletions(-)
 create mode 100644 t/helper/test-genbytes.c
 delete mode 100644 t/helper/test-genzeros.c

base-commit: fb255012acbcbe81189cb8014da0280b09c66ecc

Submitted-As: https://lore.kernel.org/git/pull.2301.v2.git.1794165304.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2301.git.1794063565.gitgitgadget@gmail.com
Assets 2
Loading