From: Johannes Sixt Date: Sun, 08 Nov 2026 09:35:15 GMT Subject: Re: [PATCH 2/3] t: add "test-tool genbytes" to avoid slow tr(1) on macOS Message-ID: <6992b7e9-8721-4e1f-9c00-9fd0e0704e80@kdbg.org> In-Reply-To: Am 08.11.26 um 10:18 schrieb Kristofer Karlsson: > On Sun, 8 Nov 2026 at 09:54, Johannes Sixt wrote: >> printf 000000000%0.2147483640d 0 > > It is definitely fast enough (on the variants I tested). > The annoying thing (but not a real blocker) is the extra memory > usage required and I am not sure I fully trust that all > implementations will behave the same for absurdly large padding. > > (Particularly for paddings larger than 2^31, as you noted too.) I don't know how to measure memory requirements, but if it helps, printf 000000000%02147483640d 0 (without the fullstop) works, too. > It feels a bit like a hack, and tweaking the existing test-tool > feels like a more sane option that is easier to reason about. > > A gotcha here is that the printf hack only works for producing > "0", so for the cases we truly need NUL characters it does not > help us, and I think that is also a point in favor of > simply generalizing test-tool genzeros instead. On the other hand, the only case you really care about is the one that takes an insane amount of time. If you convert only that case to printf, then we do not need all this churn in the first place. -- Hannes