annotate _test/temp.pl @ 332:04a093f0a5a6

IMPL::Web::Application refactoring: resources are created per client request
author cin
date Sun, 09 Jun 2013 21:48:57 +0400
parents 8d36073411b1
children f116cd9fe7d9
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
274
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
4 {
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
5 package Foo;
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
6 use IMPL::declare {
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
7 base => [
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
8 'IMPL::Object::Disposable' => undef
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
9 ]
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
10 };
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
11 }
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
12
210
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
13 use Time::HiRes qw(gettimeofday tv_interval);
215
77a9934a44af sync, migrating to XML::Compile
cin
parents: 210
diff changeset
14
210
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
15
274
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
16 use IMPL::lang;
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
17 use IMPL::require {
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
18 AutoDispose => 'IMPL::Object::AutoDispose',
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
19 DBSchema => 'IMPL::SQL::Schema'
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
20 };
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
21
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
22 my $real = DBSchema->new( name => 'simple', version => 1);
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
23 my $proxy = AutoDispose->new($real);
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
24
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
25 print typeof($proxy),"\n";
210
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
26
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
27 my $t = [gettimeofday];
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
28
274
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
29 for (1..1000000) {
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
30 $proxy->name;
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
31 }
210
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
32
274
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
33 print "proxy: ",tv_interval($t,[gettimeofday]),"\n";
210
6adaeb86945d added IMPL::Web::AutoLocator
sergey
parents: 209
diff changeset
34
274
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
35 $t = [gettimeofday];
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
36
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
37 for (1..1000000) {
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
38 $real->name;
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
39 }
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
40
8d36073411b1 +Added AutoDispose class
cin
parents: 223
diff changeset
41 print "real: ",tv_interval($t,[gettimeofday]),"\n";
215
77a9934a44af sync, migrating to XML::Compile
cin
parents: 210
diff changeset
42