From: Dan Sully Date: Sat, 22 Jul 2006 23:22:35 +0000 (+0000) Subject: Avoid a FC5 performance hit by using a named hash and then blessing it. X-Git-Tag: v0.08010~43^2~44 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=86c79482c92b9b0d7df46f3cb12ec7d1e669211c;p=dbsrgits%2FDBIx-Class.git Avoid a FC5 performance hit by using a named hash and then blessing it. --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index c71043b..39611eb 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -95,14 +95,24 @@ sub new { $attrs->{alias} ||= 'me'; - bless { + # XXXX + # Use a named hash here and bless afterwards to avoid a huge performance hit + # in perl 5.8.8-5+ FC5 and later, and possibly other distributions. + # + # See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=196836 for more + # information. + my $self = { result_source => $source, result_class => $attrs->{result_class} || $source->result_class, cond => $attrs->{where}, count => undef, pager => undef, attrs => $attrs - }, $class; + }; + + bless $self, $class; + + return $self; } =head2 search