From: Alexander Hartmaier Date: Sat, 23 Oct 2010 11:56:36 +0000 (+0200) Subject: small performance improvement X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=c82304fab4a00217bcb7e00ef39f6e6911e78881;p=chaz%2Fp5-DBIx-Class-ResultSet-RecursiveUpdate small performance improvement --- diff --git a/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm b/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm index 2d0c235..c42f1b7 100644 --- a/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm +++ b/lib/DBIx/Class/ResultSet/RecursiveUpdate.pm @@ -47,7 +47,9 @@ sub recursive_update { }; $resolved ||= {}; - # warn 'entering: ' . $self->result_source->from(); + my $source = $self->result_source; + + # warn 'entering: ' . $source->from(); carp 'fixed fields needs to be an array ref' if defined $fixed_fields && ref $fixed_fields ne 'ARRAY'; @@ -62,7 +64,7 @@ sub recursive_update { if $fixed_fields; my @missing = grep { !exists $updates->{$_} && !exists $fixed_fields{$_} } - $self->result_source->primary_columns; + $source->primary_columns; if ( !$object && !scalar @missing ) { # warn 'finding by: ' . Dumper( $updates ); use Data::Dumper; @@ -96,8 +98,6 @@ sub recursive_update { # warn 'updates: ' . Dumper( $updates ); use Data::Dumper; # warn 'columns: ' . Dumper( \%columns_by_accessor ); for my $name ( keys %$updates ) { - my $source = $self->result_source; - # columns if ( exists $columns_by_accessor{$name} && !( $source->has_relationship($name)