| 210 | 1 #!/usr/bin/perl | 
|  | 2 use strict; | 
|  | 3 | 
| 274 | 4 { | 
|  | 5     package Foo; | 
|  | 6     use IMPL::declare { | 
|  | 7         base => [ | 
|  | 8             'IMPL::Object::Disposable' => undef | 
|  | 9         ] | 
|  | 10     }; | 
|  | 11 } | 
|  | 12 | 
| 210 | 13 use Time::HiRes qw(gettimeofday tv_interval); | 
| 215 | 14 | 
| 210 | 15 | 
| 274 | 16 use IMPL::lang; | 
|  | 17 use IMPL::require { | 
|  | 18     AutoDispose => 'IMPL::Object::AutoDispose', | 
|  | 19     DBSchema => 'IMPL::SQL::Schema' | 
|  | 20 }; | 
|  | 21 | 
|  | 22 my $real = DBSchema->new( name => 'simple', version => 1); | 
|  | 23 my $proxy = AutoDispose->new($real); | 
|  | 24 | 
|  | 25 print typeof($proxy),"\n"; | 
| 210 | 26 | 
|  | 27 my $t = [gettimeofday]; | 
|  | 28 | 
| 274 | 29 for (1..1000000) { | 
|  | 30     $proxy->name; | 
|  | 31 } | 
| 210 | 32 | 
| 274 | 33 print "proxy: ",tv_interval($t,[gettimeofday]),"\n"; | 
| 210 | 34 | 
| 274 | 35 $t = [gettimeofday]; | 
|  | 36 | 
|  | 37 for (1..1000000) { | 
|  | 38     $real->name; | 
|  | 39 } | 
|  | 40 | 
|  | 41 print "real:  ",tv_interval($t,[gettimeofday]),"\n"; | 
| 215 | 42 |