diff -r e7938f859e2f -r e91f117472ed scratch/x.pl --- a/scratch/x.pl Tue Aug 02 16:08:55 2011 +0200 +++ b/scratch/x.pl Fri Aug 05 13:36:39 2011 +0200 @@ -5,6 +5,9 @@ use Crypt::CBC; use autodie qw(:all); use Benchmark qw(:all); +use Digest::MD5 qw(md5); +use Digest::SHA1 qw(sha1); +use String::CRC32; use IO::Compress::Gzip qw(gzip $GzipError); use File::Temp; @@ -18,11 +21,18 @@ ) or die; $ENV{X} = "x"; -@ARGV = qw(/boot/vmlinuz-2.6.32-5-amd64); +@ARGV = qw(/boot/vmlinuz-2.6.32-5-amd64) if not @ARGV; my $text = join "" => <>; say length $text; +cmpthese(500 => { + 'md5' => sub { _md5($text) }, + 'sha1' => sub { _sha1($text) }, + 'crc32' => sub { _crc32($text) }, + } +); + cmpthese(30 => { 'openssl' => sub { openssl($text) }, 'perlssl' => sub { perlssl($text) }, @@ -59,3 +69,15 @@ close $out; die $? if $? } + +sub _crc32 { + my $x = crc32(shift); +} + +sub _md5 { + my $x = md5(shift); +} + +sub _sha1 { + my $x = sha1(shift); +}