3 use Benchmark qw(:all);
4 use Config; printf "Perl/%vd in $Config{archname}\n\n", $^V;
8 my $cxsa_is_loaded = eval q{
21 sub new { bless {}, shift }
40 has with_tc_class_type => (
45 __PACKAGE__->meta->make_immutable;
62 has with_tc_class_type => (
67 __PACKAGE__->meta->make_immutable;
70 use B qw(svref_2object);
72 print "Moose/$Moose::VERSION (Class::MOP/$Class::MOP::VERSION)\n";
73 print "Mouse/$Mouse::VERSION\n";
74 print "Class::XSAccessor/$Class::XSAccessor::VERSION\n" if $cxsa_is_loaded;
76 my $mi = MouseOne->new();
77 my $mx = MooseOne->new();
79 $cx = CXSA->new if $cxsa_is_loaded;
82 print "\nGETTING for simple attributes\n";
95 'C::XSAccessor' => sub{
103 print "\nSETTING for simple attributes\n";
114 'C::XSAccessor' => sub{
122 print "\nGETTING for lazy attributes (except for C::XSAccessor)\n";
126 $x = $mi->with_lazy();
127 $x = $mi->with_lazy();
131 $x = $mx->with_lazy();
132 $x = $mx->with_lazy();
135 'C::XSAccessor' => sub{
143 print "\nSETTING for attributes with type constraints 'Int' (except for C::XSAccessor)\n";
154 'C::XSAccessor' => sub{
161 print "\nSETTING for attributes with type constraints 'Foo' (except for C::XSAccessor)\n";
165 $mi->with_tc_class_type($foo);
166 $mi->with_tc_class_type($foo);
169 $mx->with_tc_class_type($foo);
170 $mx->with_tc_class_type($foo);
173 'C::XSAccessor' => sub{