annotate _test/temp.pl @ 397:73f81f4e9570

sync
author cin
date Mon, 05 May 2014 18:17:03 +0400
parents 212cc86e470b
children 38cb0b80e88e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
210
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
1 #!/usr/bin/perl
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
2 use strict;
395
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
3
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
4 use Time::HiRes qw(gettimeofday tv_interval);
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
5
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
6 my $hash = {
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
7 x => 2.0,
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
8 y => 2.0,
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
9 z => 2.3,
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
10 w => 1.0
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
11 };
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
12
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
13 my $t = [gettimeofday];
210
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
14
395
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
15 for(my $i = 0; $i < 1000000; $i ++) {
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
16 $hash->{x} = $i;
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
17 }
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
18
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
19
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
20 print "HASH: ",tv_interval($t,[gettimeofday]),"\n";
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
21
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
22
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
23 my $array = [2,2,2.3,1.0];
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
24
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
25 $t = [gettimeofday];
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
26
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
27 for(my $i = 0; $i < 1000000; $i ++) {
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
28 $array->[1] = $i;
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
29 }
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
30
212cc86e470b Code cleanup
sergey
parents: 381
diff changeset
31 print "ARRAY: ",tv_interval($t,[gettimeofday]),"\n";