diff options
author | Jeff King <peff@peff.net> | 2017-05-19 02:12:12 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-20 18:18:45 +0900 |
commit | 613a0e52ea11c4496e3e154de192486a18eac2e4 (patch) | |
tree | ba35570dbd632ef85686276574abf025a0487296 /diff-delta.c | |
parent | branch: honor --abbrev/--no-abbrev in --list mode (diff) | |
download | tgif-613a0e52ea11c4496e3e154de192486a18eac2e4.tar.xz |
ref-filter: resolve HEAD when parsing %(HEAD) atom
If the user asks to display (or sort by) the %(HEAD) atom,
ref-filter has to compare each refname to the value of HEAD.
We do so by resolving HEAD fresh when calling populate_value()
on each ref. If there are a large number of refs, this can
have a measurable impact on runtime.
Instead, let's resolve HEAD once when we realize we need the
%(HEAD) atom, allowing us to do a simple string comparison
for each ref. On a repository with 3000 branches (high, but
an actual example found in the wild) this drops the
best-of-five time to run "git branch >/dev/null" from 59ms
to 48ms (~20% savings).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-delta.c')
0 files changed, 0 insertions, 0 deletions