Skip Menu |

This queue is for tickets about the Class-Accessor CPAN distribution.

Report information
The Basics
Id: 57353
Status: resolved
Priority: 0/
Queue: Class-Accessor

People
Owner: jonasbn [...] cpan.org
Requestors: RUZ [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.34
Fixed in: 0.50



Subject: [PATCH] faster contructor
Hi, Not for the first time I see people comparing constructors of modules implementing accessors. It's may be important for systems with a lot of short living objects. So I decided to make it faster :) -- Best regards, Ruslan.
Subject: Class-Accessor-0.34-faster_constructor.patch
Only in Class-Accessor-0.34-my/: Makefile Only in Class-Accessor-0.34-my/: blib diff -ur Class-Accessor-0.34/lib/Class/Accessor.pm Class-Accessor-0.34-my/lib/Class/Accessor.pm --- Class-Accessor-0.34/lib/Class/Accessor.pm 2009-09-15 20:16:41.000000000 +0400 +++ Class-Accessor-0.34-my/lib/Class/Accessor.pm 2010-05-10 20:26:14.000000000 +0400 @@ -4,13 +4,11 @@ $Class::Accessor::VERSION = '0.34'; sub new { - my($proto, $fields) = @_; - my($class) = ref $proto || $proto; - - $fields = {} unless defined $fields; - - # make a copy of $fields. - bless {%$fields}, $class; + return bless + defined $_[1] + ? {%{$_[1]}} # make a copy of $fields. + : {}, + ref $_[0] || $_[0]; } sub mk_accessors { Only in Class-Accessor-0.34-my/: pm_to_blib
Patch created in Github: https://github.com/maokt/class-accessor-pm/pull/4 Lets see what the maintainer thinks :-)
This has been addressed in release 0.50 Thank you, jonasbn