view _test/temp.pl @ 397:73f81f4e9570

sync
author cin
date Mon, 05 May 2014 18:17:03 +0400
parents 212cc86e470b
children 38cb0b80e88e
line wrap: on
line source

#!/usr/bin/perl
use strict;

use Time::HiRes qw(gettimeofday tv_interval);

my $hash = {
	x => 2.0,
	y => 2.0,
	z => 2.3,
	w => 1.0
};

my $t = [gettimeofday];

for(my $i = 0; $i < 1000000; $i ++) {
	$hash->{x} = $i;
}


print "HASH: ",tv_interval($t,[gettimeofday]),"\n";


my $array = [2,2,2.3,1.0];

$t = [gettimeofday];

for(my $i = 0; $i < 1000000; $i ++) {
	$array->[1] = $i;
}

print "ARRAY: ",tv_interval($t,[gettimeofday]),"\n";