perl: lazily load some common Git.pm setup code
commit5a544a4e11e2a08a813215c1b9cc80cc1555c7c2
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Fri, 28 May 2021 09:23:50 +0000 (28 11:23 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 28 May 2021 09:38:07 +0000 (28 18:38 +0900)
tree0547e3218463b1d27da55dc193a0abba70d948c6
parentf4dc9432fd287bde9100488943baf3c6a04d90d1
perl: lazily load some common Git.pm setup code

Instead of unconditionally requiring modules such as File::Spec, let's
only load them when needed. This speeds up code that only needs a
subset of the features Git.pm provides.

This brings a plain invocation of "git send-email" down from 52/37
loaded modules under NO_GETTEXT=[|Y] to 39/18, and it now takes
~60-~70ms instead of ~80-~90ms. The runtime of t9001-send-email.sh
test is down to ~13s from ~15s.

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