From: Fuji, Goro Date: Sat, 25 Sep 2010 09:54:21 +0000 (+0900) Subject: Add a benchmark for new_object() X-Git-Tag: 0.72~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=61714b59d225e1f0033f42117ade88940fb45acf;p=gitmo%2FMouse.git Add a benchmark for new_object() --- diff --git a/benchmarks/new_object.pl b/benchmarks/new_object.pl new file mode 100644 index 0000000..531df8c --- /dev/null +++ b/benchmarks/new_object.pl @@ -0,0 +1,33 @@ +#!perl -w +use strict; +use Benchmark qw(:all); +{ + package MyMoose; + use Moose; + has [qw(foo bar baz)] => ( + is => 'rw', + isa => 'Str', + default => 'qux', + ); + __PACKAGE__->meta->make_immutable(); +} +{ + package MyMouse; + use Mouse; + has [qw(foo bar baz)] => ( + is => 'rw', + isa => 'Str', + default => 'qux', + ); + __PACKAGE__->meta->make_immutable(); +} +print "Class->meta->new_object x 10\n"; +cmpthese -1, { + Moose => sub { + MyMoose->meta->new_object() for 10; + }, + Mouse => sub { + MyMouse->meta->new_object() for 10; + }, +}; +