X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=benchmarks%2Fmethod_modifiers.pl;h=16f1c5efb4997353830d7e73706f6cc27c332251;hb=8c70b0e6167da4bb0f3008749964f682e5c1715e;hp=890bbe57155cd43192b2ec35e2446b4291986719;hpb=f50f770723302b56ca28de95b86622f435b83dfa;p=gitmo%2FMoose.git diff --git a/benchmarks/method_modifiers.pl b/benchmarks/method_modifiers.pl index 890bbe5..16f1c5e 100755 --- a/benchmarks/method_modifiers.pl +++ b/benchmarks/method_modifiers.pl @@ -17,13 +17,13 @@ package CMMChild::Before; use Class::Method::Modifiers; use base 'PlainParent'; - + before method => sub { "B" }; } { package MooseBefore; use Moose; - extends 'PlainParent'; + extends 'MooseParent'; before method => sub { "B" }; } @@ -32,13 +32,13 @@ package CMMChild::Around; use Class::Method::Modifiers; use base 'PlainParent'; - + around method => sub { shift->() . "A" }; } { package MooseAround; use Moose; - extends 'PlainParent'; + extends 'MooseParent'; around method => sub { shift->() . "A" }; } @@ -47,7 +47,7 @@ package CMMChild::AllThree; use Class::Method::Modifiers; use base 'PlainParent'; - + before method => sub { "B" }; around method => sub { shift->() . "A" }; after method => sub { "Z" }; @@ -55,12 +55,22 @@ { package MooseAllThree; use Moose; - extends 'PlainParent'; + extends 'MooseParent'; before method => sub { "B" }; around method => sub { shift->() . "A" }; after method => sub { "Z" }; } +{ + package CMM::Install; + use Class::Method::Modifiers; + use base 'PlainParent'; +} +{ + package Moose::Install; + use Moose; + extends 'MooseParent'; +} use Benchmark qw(cmpthese); use Benchmark ':hireswallclock'; @@ -93,3 +103,15 @@ cmpthese($rounds, { ClassMethodModifiers => sub { $cmm_allthree->method() }, }, 'noc'); +print "\nINSTALL AROUND\n"; +cmpthese($rounds, { + Moose => sub { + package Moose::Install; + Moose::Install::around(method => sub {}); + }, + ClassMethodModifiers => sub { + package CMM::Install; + CMM::Install::around(method => sub {}); + }, +}, 'noc'); +