annotate _test/temp.pl @ 210:6adaeb86945d

added IMPL::Web::AutoLocator
author sergey
date Tue, 29 May 2012 20:07:22 +0400
parents a8db61d0ed33
children 77a9934a44af
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;
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
3
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
4 use Time::HiRes qw(gettimeofday tv_interval);
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
5
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
6 my $obj = {};
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
7 my @vals = qw(a b c d e f g h i j k);
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
8 my @names = qw(one two three four five six);
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
9
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
10 sub CreateMethod {
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
11 my ($dt) = @_;
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
12
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
13 $obj->{one} = $vals[1];
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
14 $obj->{two} = $vals[2];
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
15 $obj->{three} = $vals[3];
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
16 $obj->{four} = $vals[4];
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
17 $obj->{five} = $vals[5];
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
18 $obj->{six} = $vals[6];
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
19 }
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
20
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
21 my @pairs = map { [$names[$_],$_] } (1 .. $#names);
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
22
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
23 sub CreateMethodEval {
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
24 my ($dt) = @_;
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
25 my $i = 0;
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
26 map $obj->{$_} = $vals[$i++], @names;
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
27 }
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
28
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
29 my $t = [gettimeofday];
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
30
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
31
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
32
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
33 CreateMethod($_) foreach (1..1000000);
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
34
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
35 print "Build: ",tv_interval($t,[gettimeofday]),"\n";
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
36
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
37 $t = [gettimeofday];
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
38
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
39 CreateMethodEval($_) foreach (1..1000000);
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
40
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
41 print "Eval: ",tv_interval($t,[gettimeofday]),"\n";
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
42
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
43 use URI::Escape;
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
44
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
45 print uri_escape("/child///&?"), "\n";
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
46