[Dbix-class] perl 5.10.0 and Class::Accessor::Grouped
Christopher Laco
claco at chrislaco.com
Sun Dec 23 00:13:42 GMT 2007
At this point, I call 'not it'...but only because I really don't know
what in the hell is going on.
Two brand new fresh FreeBSD 6.2 installs. One with a a compiled (not
ports) Perl 5.8.8 and the other with a compiled 5.10.0.
The test case is simple set_inherited, sans C::A::G in the picture,
since the reporter noted set was slower as well (which BTW has no MRO
interaction):
test.pl
> use lib '.';
> use Foo;
> use Benchmark ':all';
> =
> my $f =3D bless {}, 'Foo';
> =
> timethese(0, {
> set_inherited_class =3D> sub {Foo->set_inherited('bar', 'baz')},
> set_inherited_object =3D> sub {$f->set_inherited('bar', 'baz')}
> });
Foo.pm
> package Foo;
> use Scalar::Util qw/blessed reftype/;
> =
> sub set_inherited {
> my ($self, $set, $val) =3D @_;
> =
> if (blessed $self) {
> if (reftype $self eq 'HASH') {
> return $self->{$set} =3D $val;
> } else {
> croak('Cannot set inherited value on an object instance that =
is not hash-based');
> };
> } else {
> no strict 'refs';
> =
> return ${$self.'::__cag_'.$set} =3D $val;
> };
> }
> =
> 1;
The results are:
Perl 5.8.8 Machine:
> Benchmark: running set_inherited_class, set_inherited_object for at least=
3 CPU seconds...
> set_inherited_class: 4 wallclock secs ( 3.16 usr + 0.00 sys =3D 3.16 C=
PU) @ 575596.40/s (n=3D1821223)
> set_inherited_object: 3 wallclock secs ( 3.16 usr + -0.01 sys =3D 3.15 =
CPU) @ 687794.82/s (n=3D2165479)
> claco at fbsd588 ~ $ =
Perl 5.10.0 Machine:
> Benchmark: running set_inherited_class, set_inherited_object for at least=
3 CPU seconds...
> set_inherited_class: 3 wallclock secs ( 3.12 usr + 0.01 sys =3D 3.13 C=
PU) @ 335388.09/s (n=3D1050708)
> set_inherited_object: 2 wallclock secs ( 3.15 usr + 0.00 sys =3D 3.15 =
CPU) @ 412676.76/s (n=3D1299287)
> claco at fbsd510 ~ $ =
My to my shock, if I whittle down the code in set_inherited to just this:
> package Foo;
> use Scalar::Util qw/blessed reftype/;
> =
> sub set_inherited {
> my ($self, $set, $val) =3D @_;
> =
> }
> =
> 1;
performance still seriouesly sucks:
5.8.8
> Benchmark: running set_inherited_class, set_inherited_object for at least=
3 CPU seconds...
> set_inherited_class: 3 wallclock secs ( 3.08 usr + 0.02 sys =3D 3.09 C=
PU) @ 1199923.07/s (n=3D3712262)
> set_inherited_object: 4 wallclock secs ( 3.27 usr + 0.00 sys =3D 3.27 =
CPU) @ 1380589.06/s (n=3D4519272)
> claco at fbsd588 ~ $ =
5.10.0
> Benchmark: running set_inherited_class, set_inherited_object for at least=
3 CPU seconds...
> set_inherited_class: 4 wallclock secs ( 3.09 usr + 0.01 sys =3D 3.10 C=
PU) @ 536733.34/s (n=3D1664712)
> set_inherited_object: 4 wallclock secs ( 3.13 usr + 0.00 sys =3D 3.13 =
CPU) @ 638055.42/s (n=3D1998908)
> claco at fbsd510 ~ $ =
A this point, I'm stumped.
-=3DChris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20071222/d3=
115f05/signature.pgp
More information about the DBIx-Class
mailing list