File: create_many.pl

package info (click to toggle)
libhash-fieldhash-perl 0.15-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 296 kB
  • sloc: perl: 1,249; ansic: 207; makefile: 10
file content (59 lines) | stat: -rw-r--r-- 862 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!perl -w
use strict;
use Benchmark qw(:all);

use Hash::FieldHash ();

my $HUF;
BEGIN{
	if( eval{ require Hash::Util::FieldHash } ){
		$HUF = 'Hash::Util::FieldHash';
	}
	else{
		require Hash::Util::FieldHash::Compat;
		$HUF = 'Hash::Util::FieldHash::Compat';
	}

	$HUF->import(qw(fieldhash));
}

printf "Perl %vd on $^O\n", $^V;

print "$HUF ", $HUF->VERSION, "\n";
print "Hash::FieldHash ", Hash::FieldHash->VERSION, "\n";

fieldhash my %huf;
Hash::FieldHash::fieldhash my %hf;

my %hash;

cmpthese timethese -1 => {
	'H::U::F' => sub{
		my @list;

		for(1 .. 1000){
			my $o = bless {};
			$huf{$o}++;
			push @list, $o;
		}
	},
	'H::F' => sub{
		my @list;

		for(1 .. 1000){
			my $o = bless {};
			$hf{$o}++;
			push @list, $o;
		}
	},
	'normal' => sub{
		my @list;

		for(1 .. 1000){
			my $o = bless {};
			$o->{value}++;
			push @list, $o;
		}
	},
	
};