From e6aa13bccb7ea5d5b3246b3a944621515905e360 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 29 Jan 2023 10:30:41 +0000 Subject: use Net::SSLeay (OpenSSL) for SHA-(1|256) if installed On my x86-64 machine, OpenSSL SHA-256 is nearly twice as fast as the Digest::SHA implementation from Perl, most likely due to an optimized assembly implementation. SHA-1 is a few percent faster, too. --- lib/PublicInbox/Fetch.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/Fetch.pm') diff --git a/lib/PublicInbox/Fetch.pm b/lib/PublicInbox/Fetch.pm index 198e2a60..f93eeebe 100644 --- a/lib/PublicInbox/Fetch.pm +++ b/lib/PublicInbox/Fetch.pm @@ -92,9 +92,9 @@ sub do_manifest ($$$) { sub get_fingerprint2 { my ($git_dir) = @_; - require Digest::SHA; + require PublicInbox::SHA; my $rd = popen_rd([qw(git show-ref)], undef, { -C => $git_dir }); - Digest::SHA::sha256(do { local $/; <$rd> }); + PublicInbox::SHA::sha256(do { local $/; <$rd> }); } sub writable_dir ($) { -- cgit v1.2.3-24-ge0c7