]> git.ipfire.org Git - thirdparty/git.git/commit - git-send-email.perl
send-email: lazily load modules for a big speedup
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 28 May 2021 09:23:49 +0000 (11:23 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 28 May 2021 09:38:07 +0000 (18:38 +0900)
commitf4dc9432fd287bde9100488943baf3c6a04d90d1
tree62e9d43e40f1901413b20c6d48f82943b4c80b39
parent447ed29c0d414547914c23e92f8bb13fcf748f9b
send-email: lazily load modules for a big speedup

Optimize the time git-send-email takes to do even the simplest of
things (such as serving up "-h") from around ~150ms to ~80ms-~90ms by
lazily loading the modules it requires.

Before this change Devel::TraceUse would report 99/97 used modules
under NO_GETTEXT=[|Y], respectively. Now it's 52/37. It now takes ~15s
to run t9001-send-email.sh, down from ~20s.

Changing File::Spec::Functions::{catdir,catfile} to invoking class
methods on File::Spec itself is idiomatic. See [1] for a more
elaborate explanation, the resulting code behaves the same way, just
without the now-pointless function wrapper.

1. http://lore.kernel.org/git/8735u8mmj9.fsf@evledraar.gmail.com

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-send-email.perl