Re: [PATCH v2 08/10] generate-cmdlist.sh: do not shell out to "sed"
From: Jeff King <hidden>
Date: 2021-10-25 16:46:47
On Fri, Oct 22, 2021 at 09:36:12PM +0200, Ævar Arnfjörð Bjarmason wrote:
From: Jeff King <redacted> 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