Created
June 5, 2009 10:53
-
-
Save mash/124224 to your computer and use it in GitHub Desktop.
This file contains 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 Data::UUID; | |
use Digest::SHA1 qw/sha1_hex/; | |
use Benchmark qw/cmpthese/; | |
my $uuid_generator = new Data::UUID; | |
cmpthese( 10000, { | |
pre_generate => sub { | |
sha1_hex( $uuid_generator->create ); | |
}, | |
generate_per_request => sub { | |
sha1_hex( Data::UUID->new->create ); | |
}, | |
}); | |
santrini% ./uuid_bench.pl | |
(warning: too few iterations for a reliable count) | |
Rate generate_per_request pre_generate | |
generate_per_request 8403/s -- -97% | |
pre_generate 250000/s 2875% -- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment