summaryrefslogtreecommitdiff
path: root/attr.c
diff options
context:
space:
mode:
authorLibravatar Ævar Arnfjörð Bjarmason <avarab@gmail.com>2021-05-28 11:23:45 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-05-28 18:38:07 +0900
commit9264d29bf6da9e1789d71807dd72bbd4fb447887 (patch)
tree258e0e4a0c8e44d4fd9cd7b96925d308d844cfa0 /attr.c
parentsend-email: copy "config_regxp" into git-send-email.perl (diff)
downloadtgif-9264d29bf6da9e1789d71807dd72bbd4fb447887.tar.xz
send-email: lazily load config for a big speedup
Reduce the time it takes git-send-email to get to even the most trivial of tasks (such as serving up its "-h" output) by first listing config keys that exist, and only then only call e.g. "git config --bool" on them if they do. Over a lot of runs this speeds the time to "-h" up for me from ~250ms to ~150ms, and the runtime of t9001-send-email.sh goes from ~25s to ~20s. This introduces a race condition where we'll do the "wrong" thing if a config key were to be inserted between us discovering the list and calling read_config(), i.e. we won't know about the racily added key. In theory this is a change in behavior, in practice it doesn't matter. The config_regexp() function being changed here was added in dd84e528a34 (git-send-email: die if sendmail.* config is set, 2020-07-23) for use by git-send-email. So we can change its odd return value in the case where no values are found by "git config". The difference in the *.pm code would matter if it was invoked in scalar context, but now it no longer is. Arguably this caching belongs in Git.pm itself, but in lieu of modifying it for all its callers let's only do this for "git send-email". The other big potential win would be "git svn", but unlike "git send-email" it doesn't check tens of config variables one at a time at startup (in my brief testing it doesn't check any). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'attr.c')
0 files changed, 0 insertions, 0 deletions