sorry konobi, not enough of a perf win, so lets wait till we get something more befor...
[gitmo/Moose.git] / benchmarks / simple_constructor.pl
CommitLineData
c8cf9aaa 1#!/usr/bin/perl
2
3use strict;
4use warnings;
5
6my $num_iterations = shift || 100;
7
8{
9 package Foo;
10 use Moose;
11
12 has 'default' => (is => 'rw', default => 10);
13 has 'default_sub' => (is => 'rw', default => sub { [] });
14 has 'lazy' => (is => 'rw', default => 10, lazy => 1);
15 has 'required' => (is => 'rw', required => 1);
16 has 'weak_ref' => (is => 'rw', weak_ref => 1);
17 has 'type_constraint' => (is => 'rw', isa => 'ArrayRef');
18}
19
20foreach (0 .. $num_iterations) {
21 my $foo = Foo->new(
22 required => 'BAR',
23 type_constraint => [],
24 weak_ref => {},
25 );
26}