Re: Moose speed and schedule
[email protected] (Jonathan Swartz)
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
Hey, this looks great! I took a long look at Class::Meta as a
temporary Moose replacement but was repelled by the heavy declarative
syntax. Express looks like just the remedy. Is it pretty reliable and
suported...do you have production systems using it?
You really ought to mention Class::Meta::Express from the Class::Meta
documentation! As it is I never would have found it without your help.
Looking forward to giving this a try. Thanks guys.
Jon
On Nov 12, 2006, at 5:29 PM, David E. Wheeler wrote:
> On Nov 12, 2006, at 11:51, Jonathan Swartz wrote:
>
>> Results on my 1.5 GHz PowerPC G4:
>>
>> swartz> ./bench.pl
>> Using Moose version 0.15, Class::MOP version 0.36,
>> Class::Accessor version 0.27
>> Benchmark: timing 1000 iterations of ClassAccessorPage,
>> MoosePage...
>> ClassAccessorPage: 0 wallclock secs ( 0.02 usr + 0.00 sys =
>> 0.02 CPU) @ 50000.00/s (n=1000)
>> (warning: too few iterations for a reliable count)
>> MoosePage: 22 wallclock secs (18.41 usr + 0.33 sys = 18.74
>> CPU) @ 53.36/s (n=1000)
>
> Yow! Maybe try my Class::Meta module, instead? It has a lot that's
> similar to Moose, and the two will likely be merged eventually
> (assuming that I find the tuits), and it doesn't suffer from this
> problem:
>
> #!/usr/bin/perl -w
>
> use strict;
>
> use Benchmark;
> use strict;
> use warnings;
>
> { package ClassMetaPage;
> use Class::Meta::Express;
> class {
> meta 'test';
> ctor 'new';
> has title => ( type => 'scalar' )
> };
> }
>
> { package ClassAccessorPage;
> use strict;
> use warnings;
> use base qw(Class::Accessor);
>
> __PACKAGE__->mk_accessors(qw(title));
> }
>
> printf "Using Class::Meta version %s, Class::Accessor version %s\n",
> $Class::Meta::VERSION, $Class::Accessor::VERSION;
>
> timethese(100000, {
> 'ClassMetaPage' => sub { ClassMetaPage->new(title => 'article') },
> 'ClassAccessorPage' => sub { ClassAccessorPage->new({title =>
> 'article'}) },
> });
>
> On my PowerBook G4 1.33 GHz:
>
> Using Class::Meta version 0.53, Class::Accessor version 0.27
> Benchmark: timing 100000 iterations of ClassAccessorPage,
> ClassMetaPage...
> ClassAccessorPage: 2 wallclock secs ( 1.17 usr + 0.01 sys = 1.18
> CPU) @ 84745.76/s (n=100000)
> ClassMetaPage: 4 wallclock secs ( 3.74 usr + 0.02 sys = 3.76
> CPU) @ 26595.74/s (n=100000)
>
>
> Best,
>
> David
>