210
|
1 #!/usr/bin/perl
|
|
2 use strict;
|
395
|
3
|
|
4 use Time::HiRes qw(gettimeofday tv_interval);
|
|
5
|
|
6 my $hash = {
|
|
7 x => 2.0,
|
|
8 y => 2.0,
|
|
9 z => 2.3,
|
|
10 w => 1.0
|
|
11 };
|
|
12
|
|
13 my $t = [gettimeofday];
|
210
|
14
|
395
|
15 for(my $i = 0; $i < 1000000; $i ++) {
|
|
16 $hash->{x} = $i;
|
|
17 }
|
|
18
|
|
19
|
|
20 print "HASH: ",tv_interval($t,[gettimeofday]),"\n";
|
|
21
|
|
22
|
|
23 my $array = [2,2,2.3,1.0];
|
|
24
|
|
25 $t = [gettimeofday];
|
|
26
|
|
27 for(my $i = 0; $i < 1000000; $i ++) {
|
|
28 $array->[1] = $i;
|
|
29 }
|
|
30
|
|
31 print "ARRAY: ",tv_interval($t,[gettimeofday]),"\n"; |