view _test/temp.pl @ 409:f7eeafbd33da ref20150831

sync
author cin
date Sun, 13 Sep 2015 19:30:49 +0300
parents c6e90e02dd17
children ee36115f6a34
line wrap: on
line source

#!/usr/bin/perl
use strict;

use Time::HiRes qw(gettimeofday tv_interval);
use constant COUNT => 20000000;

my $t;

$t = [gettimeofday];

for ( my $i = 0 ; $i < COUNT ; $i++ ) {
    my $o = [];
    $o->[0] = 10;
    $o->[20] = 11;
}

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

$t = [gettimeofday];


for ( my $i = 0 ; $i < COUNT ; $i++ ) {
    my $o = {};	
    $o->{a} = 10;
    $o->{b} = 11;
}

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



1;