Created
May 3, 2012 09:11
-
-
Save melo/2584547 to your computer and use it in GitHub Desktop.
Digest::CRC vs String::CRC32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) }, | |
} | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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