A re-roll of [1], the work I based v1 on top of has landed in master, so this has been rebased on master. The changes here are minor, just a typo fix / commit message clarification, moving "require" closer to where it's used, and finally a new 10/10 patch to s/cwd/getcwd/g. As noted in the commit message I don't think that'll make any difference in practice. The "time" Eric posted was for loading Cwd.pm and then doing cwd() or getcwd(), but when we run it we've already paid the cost of loading Cwd.pm. But it was an easy change to make, so let's make it anyway. 1. https://lore.kernel.org/git/cover-0.9-0000000000-20210512T132955Z-avarab@xxxxxxxxx/ Ævar Arnfjörð Bjarmason (10): send-email: remove non-working support for "sendemail.smtpssl" send-email: refactor sendemail.smtpencryption config parsing send-email: lazily load config for a big speedup send-email: lazily shell out to "git var" send-email: use function syntax instead of barewords send-email: get rid of indirect object syntax send-email: lazily load modules for a big speedup perl: lazily load some common Git.pm setup code send-email: move trivial config handling to Perl perl: nano-optimize by replacing Cwd::cwd() with Cwd::getcwd() Documentation/config/sendemail.txt | 3 - git-send-email.perl | 146 +++++++++++++++++------------ perl/Git.pm | 49 +++++----- 3 files changed, 111 insertions(+), 87 deletions(-) Range-diff against v1: 1: 92571a8cf7f < -: ----------- Makefile: make PERL_DEFINES recursively expanded 2: 85b706d43fc ! 1: 8474acae689 send-email: remove non-working support for "sendemail.smtpssl" @@ Metadata ## Commit message ## send-email: remove non-working support for "sendemail.smtpssl" - Remove the already dead code to support "sendemail.smtssl" by finally + Remove the already dead code to support "sendemail.smtpssl" by finally removing the dead code supporting the configuration option. In f6bebd121ac (git-send-email: add support for TLS via 3: c22af817f10 = 2: b87f53adbed send-email: refactor sendemail.smtpencryption config parsing 4: 1e14d322535 = 3: 1b27a393ae3 send-email: lazily load config for a big speedup 5: e1df469d5fe = 4: acee22b77d2 send-email: lazily shell out to "git var" 6: 8846d40fc02 = 5: f317cd1c01e send-email: use function syntax instead of barewords 7: 0dde0e14ef6 = 6: fc27024f838 send-email: get rid of indirect object syntax 8: 55a0b07062f ! 7: f86f5453d7a send-email: lazily load modules for a big speedup @@ git-send-email.perl: sub do_edit { # Handle Uncouth Termination sub signal_handler { -+ require Term::ANSIColor; - +- # Make text normal - print color("reset"), "\n"; ++ require Term::ANSIColor; + print Term::ANSIColor::color("reset"), "\n"; # SMTP password masked 9: 2312346f71e = 8: 86641377c0d perl: lazily load some common Git.pm setup code 10: 0d87c9a5a37 ! 9: 895c9e29a96 send-email: move trivial config handling to Perl @@ Commit message Optimize the startup time of git-send-email by using an amended config_regexp() function to retrieve the list of config keys and - values we're interested in. + values we're interested in. See the earlier "send-email: lazily load + config for a big speedup" commit for why changing its interface is OK. For boolean keys we can handle the [true|false] case ourselves, and the "--get" case didn't need any parsing. Let's leave "--path" and @@ Commit message "git send-email". This brings the runtime of "git send-email" from ~60-~70ms to a very - steady ~40ms on my test box. We no run just one "git config" + steady ~40ms on my test box. We now run just one "git config" invocation on startup instead of 8, the exact number will differ based on the local sendemail.* config. I happen to have 8 of those set. -: ----------- > 10: 97455f993d5 perl: nano-optimize by replacing Cwd::cwd() with Cwd::getcwd() -- 2.32.0.rc0.405.g5d387561bb3