comparison _test/temp.pl @ 197:6b1dda998839

Added IMPL::declare, IMPL::require, to simplify module definitions IMPL::Transform now admires object inheritance while searching for the transformation Added HTTP some exceptions IMPL::Web::Application::RestResource almost implemented
author sergey
date Thu, 19 Apr 2012 02:10:02 +0400
parents 4d0e1962161c
children 2ffe6f661605
comparison
equal deleted inserted replaced
196:a705e848dcc7 197:6b1dda998839
1 #!/usr/bin/perl 1 #!/usr/bin/perl
2 use strict; 2 use strict;
3 use Time::HiRes qw(gettimeofday tv_interval);
4 3
5 sub func { 4 package Bar;
6 1; 5
6 sub CTOR {
7 shift;
8 warn @_;
7 } 9 }
8 10
9 my $t0 = [gettimeofday()]; 11 package Foo;
10 12
11 for(my $i = 0; $i < 1000000; $i++) { 13 use IMPL::declare {
12 func(1); 14 require => {
15 TObject => 'IMPL::Object'
16 },
17 base => {
18 TObject => '@_',
19 -Bar => '@_'
20 }
21 };
22
23 sub hello {
24 return TObject;
13 } 25 }
14 26
15 print tv_interval($t0),"\n"; 27 package main;
16 28
17 my $fn = sub { 1; }; 29 print Foo->new(qw(one for me))->hello;
18
19 $t0 = [gettimeofday()];
20
21 for(my $i = 0; $i < 1000000; $i++) {
22 &$fn(1);
23 }
24
25 print tv_interval($t0),"\n";
26
27 sub dummy() { 0; }
28
29 $t0 = [gettimeofday()];
30
31 for(my $i = 0; $i < 1000000; $i++) {
32 dummy;
33 }
34
35 print tv_interval($t0),"\n";
36
37 $t0 = [gettimeofday()];
38
39 for(my $i = 0; $i < 1000000; $i++) {
40 1;
41 }
42
43 print tv_interval($t0),"\n";
44