Skip to content

Instantly share code, notes, and snippets.

@melo
Created May 3, 2012 09:11
Show Gist options
  • Save melo/2584547 to your computer and use it in GitHub Desktop.
Save melo/2584547 to your computer and use it in GitHub Desktop.
Digest::CRC vs String::CRC32
#!/usr/bin/env perl
use 5.014;
use warnings;
use Benchmark 'cmpthese';
use Digest::CRC ();
use String::CRC32 ();
my $payload = 'a' x 1024;
cmpthese(
-2,
{ 'Digest::CRC' => sub { Digest::CRC::crc32($payload) },
'String::CRC32' => sub { String::CRC32::crc32($payload) },
}
);
Rate Digest::CRC String::CRC32
Digest::CRC 432/s -- -100%
String::CRC32 285460/s 65967% --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment