Created
May 19, 2011 02:41
-
-
Save kazeburo/980078 to your computer and use it in GitHub Desktop.
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 strict; | |
| use warnings; | |
| use 5.10.0; | |
| use Digest::MD5 qw/md5/; | |
| use Digest::MurmurHash qw/murmur_hash/; | |
| use Digest::MurmurHash3 qw/murmur32 murmur128_x64/; | |
| use Benchmark qw/cmpthese/; | |
| say murmur_hash(1); | |
| say murmur32(1); | |
| say join ',',murmur128_x64(1); | |
| cmpthese(500,{ | |
| '1' => sub { | |
| murmur_hash('x'x20 . $_) for 1..10000; | |
| }, | |
| '3' => sub { | |
| murmur32('x'x20 . $_) for 1..10000; | |
| }, | |
| '3-128' => sub { | |
| murmur128_x64('x'x20 . $_) for 1..10000; | |
| }, | |
| 'md5' => sub { | |
| md5('x'x20 . $_) for 1..10000; | |
| } | |
| }); | |
| __DATA__ | |
| 1825710598 | |
| 2514386435 | |
| 8213365047359667313,10676604921780958775 | |
| Rate md5 3-128 3 1 | |
| md5 85.2/s -- -42% -51% -57% | |
| 3-128 148/s 74% -- -15% -25% | |
| 3 174/s 105% 18% -- -12% | |
| 1 198/s 132% 34% 13% -- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment