Re: [PATCH v3 24/34] t/perf/p7519: speed up test using "test-tool touch"
- From
- Jeff Hostetler <git@jeffhostetler.com>
- Date
- Jul 13, 2021, 17:58 UTC
- Message-ID
- <797f4e85-33cc-df7e-31d8-3a4f95a9109a@jeffhostetler.com>
- In-Reply-To
- <CABPp-BF+GiAZVxeC+MAr6pSssRpSi2pNwHLrxUp9HvrOhUBieg@mail.gmail.com>
On 7/13/21 1:36 PM, Elijah Newren wrote:
Show 29 quoted lines
> On Tue, Jul 13, 2021 at 10:10 AM Jeff Hostetler <git@jeffhostetler.com> wrote: >> >> On 7/1/21 7:09 PM, Ævar Arnfjörð Bjarmason wrote: >>> >>> Did you try to replace this with some variant of: >>> >>> test_seq 1 10000 | xargs touch >>> >>> Which (depending on your xargs version) would invoke "touch" commands >>> with however many argv items it thinks you can handle. >> >> a quick test on my Windows machine shows that >> >> test_seq 1 10000 | xargs touch >> >> takes 3.1 seconds. >> >> just a simple >> >> test_seq 1 10000 >/dev/null >> >> take 0.2 seconds. >> >> using my test-tool helper cuts that time in half. > > Yeah, test_seq is pretty bad; it's just a loop in shell. Is there a > 'seq' on windows, and does using it instead of test_seq make things > faster with Ævar's suggested command? >
The Git for Windows SDK bash environment does have a /usr/bin/seq which appears to be from GNU coreutils 8.32. (This is different from the version that I have on my Mac (which doesn't have a version number).)
Using it:
seq 1 10000 >/dev/null
takes 0.04 seconds instead of 0.2.
However, it doesn't help the touch.
seq 1 10000 | xargs touch
still takes ~3.1 seconds.
FWIW, the xargs is clustering the 10,000 files into ~4 command lines, so there is a little bit of Windows process overhead, but not that much.
seq 1 10000 | xargs wc -l | grep total
Show 8 quoted lines
> I'd really like to modify test_seq to use seq when it's available and > fall back to the looping-in-shell when we need to for various > platforms. > > Maybe it'd even make sense to write a 'test-tool seq' and make > test_seq use that just so we can rip out that super lame shell > looping. >