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. --- xt/imapd-validate.t | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'xt/imapd-validate.t') diff --git a/xt/imapd-validate.t b/xt/imapd-validate.t index 5d27d2a0..5d665fa9 100644 --- a/xt/imapd-validate.t +++ b/xt/imapd-validate.t @@ -1,11 +1,12 @@ #!perl -w -# Copyright (C) 2020-2021 all contributors +# Copyright (C) all contributors # License: AGPL-3.0+ # Expensive test to validate compression and TLS. use strict; use v5.10.1; use Symbol qw(gensym); use PublicInbox::DS qw(now); +use PublicInbox::SHA; use POSIX qw(_exit); use PublicInbox::TestCommon; my $inbox_dir = $ENV{GIANT_INBOX_DIR}; @@ -64,7 +65,7 @@ my $do_get_all = sub { my ($desc, $opt) = @_; local $SIG{__DIE__} = sub { print STDERR $desc, ': ', @_; _exit(1) }; my $t0 = now(); - my $dig = Digest::SHA->new(1); + my $dig = PublicInbox::SHA->new(1); my $mic = $imap_client->new(%$opt); $mic->examine($mailbox) or die "examine: $!"; my $uid_base = 1; -- cgit v1.2.3-24-ge0c7