summaryrefslogtreecommitdiff
path: root/builtin/repack.c
diff options
context:
space:
mode:
authorLibravatar René Scharfe <l.s.r@web.de>2020-02-04 22:24:24 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-02-05 10:24:15 -0800
commit1c56fc208400011b196f571041a0bc694fc9637c (patch)
tree22ec3e5b7dfdbc75309d9deca1bb9d46fc70de5d /builtin/repack.c
parentname-rev: factor out get_parent_name() (diff)
downloadtgif-1c56fc208400011b196f571041a0bc694fc9637c.tar.xz
name-rev: pre-size buffer in get_parent_name()
We can calculate the size of new name easily and precisely. Open-code the xstrfmt() calls and grow the buffers as needed before filling them. This provides a surprisingly large benefit when working with the Chromium repository; here are the numbers measured using hyperfine before: Benchmark #1: ./git -C ../chromium/src name-rev --all Time (mean ± σ): 5.822 s ± 0.013 s [User: 5.304 s, System: 0.516 s] Range (min … max): 5.803 s … 5.837 s 10 runs ... and with this patch: Benchmark #1: ./git -C ../chromium/src name-rev --all Time (mean ± σ): 1.527 s ± 0.003 s [User: 1.015 s, System: 0.511 s] Range (min … max): 1.524 s … 1.535 s 10 runs Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/repack.c')
0 files changed, 0 insertions, 0 deletions