Leser: 1
|< 1 2 >| | 20 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use strict;
use warnings;
use Benchmark qw/cmpthese/;
sub hashmap { my $cnt = 1; map { $_, $cnt++ } @_; }
my @sml_list = ( 'a'..'z' );
my @big_list = map { my $char = $_; map { "$char$_" } 'a'..'z' } 'a'..'z';
my %sml_hash = hashmap( @sml_list );
my %big_hash = hashmap( @big_list );
cmpthese( -1, {
sml => sub { defined $sml_hash{ $sml_list[ rand @sml_list ] }; },
big => sub { defined $big_hash{ $big_list[ rand @big_list ] }; },
} );
|< 1 2 >| | 20 Einträge, 2 Seiten |