summaryrefslogtreecommitdiff
path: root/environment.c
diff options
context:
space:
mode:
authorLibravatar Ævar Arnfjörð Bjarmason <avarab@gmail.com>2021-11-05 15:08:08 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-11-05 12:01:13 -0700
commit1cecd06e36452bfb8d074cda2083cc71ff089404 (patch)
treec589916ed990083a98a4cd41148c33d9de0b74f9 /environment.c
parentgenerate-cmdlist.sh: replace "grep' invocation with a shell version (diff)
downloadtgif-1cecd06e36452bfb8d074cda2083cc71ff089404.tar.xz
generate-cmdlist.sh: don't parse command-list.txt thrice
Change the "define_categories()" and "define_category_names()" functions to take the already-parsed output of "category_list()" as an argument, which brings our number of passes over "command-list.txt" from three to two. Then have "category_list()" itself take the output of "command_list()" as an argument, bringing the number of times we parse the file to one. Compared to the pre-image this speeds us up quite a bit: $ git show HEAD~:generate-cmdlist.sh >generate-cmdlist.sh.old $ hyperfine --warmup 10 -L v ,.old 'sh generate-cmdlist.sh{v} command-list.txt' Benchmark #1: sh generate-cmdlist.sh command-list.txt Time (mean ± σ): 22.9 ms ± 0.3 ms [User: 15.8 ms, System: 9.6 ms] Range (min … max): 22.5 ms … 24.0 ms 125 runs Benchmark #2: sh generate-cmdlist.sh.old command-list.txt Time (mean ± σ): 30.1 ms ± 0.4 ms [User: 24.4 ms, System: 17.5 ms] Range (min … max): 29.5 ms … 32.3 ms 96 runs Summary 'sh generate-cmdlist.sh command-list.txt' ran 1.32 ± 0.02 times faster than 'sh generate-cmdlist.sh.old command-list.txt' Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'environment.c')
0 files changed, 0 insertions, 0 deletions