Re: [PATCH 0/3] t: add "test-tool genbytes" to avoid slow tr(1) on macOS
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 7, 2026, 23:23 UTC
- Message-ID
- <xmqqjymo8bv6.fsf@gitster.g>
- In-Reply-To
- <pull.2301.git.1794063565.gitgitgadget@gmail.com>
"Kristofer Karlsson via GitGitGadget" <gitgitgadget@gmail.com> writes:
> Open question: is patch 3 wanted? It folds "genzeros" into "genbytes", > spelling the NUL byte as "NUL", so that there is a single command.
I would suggest genbytes to take the value of the byte in decimal or hex, instead of av[1][0], so that you do not have to treat NUL any specially. I would actually think it is even better to limit the input format only to [0-9a-f][0-9a-f], i.e., two hexadecimal digits that does not allow uppercase to represent values 0-255 (inclusive), without support for any other input format like decimal.
After all, this is just a test helper, so ergonomics or flexibility do not matter as much as simplicity.
Show 7 quoted lines
> 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.
Shouldn't matter.
> * Invalid counts are still silently treated as 0, as before. That could be > tightened, but it is unrelated to this series.
Shouldn't matter. That's ergonomics and flexibility that we do not value as much as in a normal program.
Thanks.