Re: [PATCH v2 08/10] generate-cmdlist.sh: do not shell out to "sed"
- From
Jeff King <peff@peff.net>
- Date
- Oct 25, 2021, 16:46 UTC
- Message-ID
- <YXbfdEqKHc5b19u9@coredump.intra.peff.net>
- In-Reply-To
- <patch-v2-08.10-83318d6c0da-20211022T193027Z-avarab@gmail.com>
On Fri, Oct 22, 2021 at 09:36:12PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 5 quoted lines
> From: Jeff King <peff@peff.net> > > Replace the "sed" invocation in get_synopsis() with a pure-shell > version. This speeds up generate-cmdlist.sh significantly. Compared to > HEAD~ (old) and "master" we are, according to hyperfine(1):
Unsurprisingly I'm in favor of this. ;)
Curiously again, I get more dramatic results than you:
> 'sh generate-cmdlist.sh command-list.txt' ran > 12.69 ± 5.01 times faster than 'sh generate-cmdlist.sh.old command-list.txt' > 18.34 ± 3.03 times faster than 'sh generate-cmdlist.sh.master command-list.txt'
'sh generate-cmdlist.sh command-list.txt' ran
22.44 ± 13.59 times faster than 'sh generate-cmdlist.sh.old command-list.txt'
57.35 ± 34.10 times faster than 'sh generate-cmdlist.sh.master command-list.txt'It's like spawning processes is somehow faster on your machine than mine. I wonder if it's a CPU governor thing. This is a laptop, and those numbers come from using "powersave". Doing "cpufreq-set -g performance", I get:
'sh generate-cmdlist.sh command-list.txt' ran 14.35 ± 0.23 times faster than 'sh generate-cmdlist.sh.old command-list.txt' 33.15 ± 0.50 times faster than 'sh generate-cmdlist.sh.master command-list.txt'
which is closer. But most notably all versions are 3-5x faster than their "powersave" counterparts. I wonder if that has been driving some of the confusion in our timings in this thread.
Either way, I think this is still a good direction to go.
-Peff