Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /usr/share/doc/perl-Hash-FieldHash/benchmark/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/doc/perl-Hash-FieldHash/benchmark/create_many.pl
#!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;
		}
	},
	
};

Hry