From: Patrick Steinhardt Date: Fri, 03 Jul 2026 05:42:16 GMT Subject: Re: [PATCH 3/9] t4141: fix inefficient use of dd(1) Message-ID: In-Reply-To: On Thu, Jul 02, 2026 at 07:49:50PM +0200, SZEDER Gábor wrote: > On Thu, Jul 02, 2026 at 02:00:56PM +0200, Patrick Steinhardt wrote: > > In t4141 we generate a patch that is roughly 1GB in size to verify that > > git-apply(1) indeed rejects that patch. We generate that patch by > > prepending a patch header and then executing `test-tool genzeros` > > without a limit. This causes us to print infinitely many zeros, and we > > limit the overall amount of generated bytes via `test_copy_bytes`. > > > > This test setup is extremely expensive, as `test_copy_bytes` is > > implemented via `dd ibs=1 count="$1"`, which copies data one byte at a > > time. So as we write 1GB of data, we end up doing 1 billion reads and > > writes. This naturally takes a while: it takes 6 minutes on my system, > > and around 40 minutes in some CI jobs! > > > > We can do much better though, as genzeros already knows to handle an > > optional limit of how much data it is supposed to write, which allows us > > to remove the call to `test_copy_bytes`. Furthermore, it has already > > been optimized to generate the data fast. > > > > And indeed, doing this conversion drops the test execution to less than > > a second on my machine, so that we can drop the EXPENSIVE prerequisite. > > EXPENSIVE is not only about execution time, but about resources in > general. While the modified test finishes quite fast indeed, 'git > apply' uses over 1GB of RSS. Therefore, the EXPENSIVE prerequisite > should be kept. That's fair. It's questionable whether 1GB of RSS really is expensive nowadays anymore, but I don't mind reinstating the prerequisite. Patrick