Mercurial > pub > Impl
diff _test/temp.pl @ 274:8d36073411b1
+Added AutoDispose class
*code cleanups
author | cin |
---|---|
date | Wed, 30 Jan 2013 03:30:28 +0400 |
parents | edf011437be8 |
children | f116cd9fe7d9 |
line wrap: on
line diff
--- a/_test/temp.pl Tue Jan 29 17:19:10 2013 +0400 +++ b/_test/temp.pl Wed Jan 30 03:30:28 2013 +0400 @@ -1,29 +1,42 @@ #!/usr/bin/perl use strict; -use XML::Compile::Schema; -use XML::Compile::Util qw(pack_type pack_id); -use Data::Dumper; +{ + package Foo; + use IMPL::declare { + base => [ + 'IMPL::Object::Disposable' => undef + ] + }; +} + use Time::HiRes qw(gettimeofday tv_interval); - -my $schema = XML::Compile::Schema->new('Resources/resources.xsd'); -$schema->printIndex(); -my $type = pack_type 'http://implab.org/schemas/resources', 'resources'; -my $reader = $schema->compile( - READER => $type, - xsi_type => { - pack_type('http://implab.org/schemas/resources','AbstractResult') => 'AUTO' - } -); +use IMPL::lang; +use IMPL::require { + AutoDispose => 'IMPL::Object::AutoDispose', + DBSchema => 'IMPL::SQL::Schema' +}; + +my $real = DBSchema->new( name => 'simple', version => 1); +my $proxy = AutoDispose->new($real); + +print typeof($proxy),"\n"; my $t = [gettimeofday]; -my $obj = $reader->('Resources/sample.xml'); +for (1..1000000) { + $proxy->name; +} -print "Parsing small Xml file: ",tv_interval($t,[gettimeofday]),"\n"; +print "proxy: ",tv_interval($t,[gettimeofday]),"\n"; -print Dumper( $obj ); +$t = [gettimeofday]; + +for (1..1000000) { + $real->name; +} + +print "real: ",tv_interval($t,[gettimeofday]),"\n"; -