Skip Menu |

This queue is for tickets about the MooseX-Storage CPAN distribution.

Report information
The Basics
Id: 96426
Status: new
Priority: 0/
Queue: MooseX-Storage

People
Owner: Nobody in particular
Requestors: Mario.Paumann [...] apa.at
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: Gortan Philipp <philipp.gortan [...] apa.at>, Eder Christian <Christian.Eder [...] apa.at>
Subject: engine_traits performanceflaw
Date: Fri, 13 Jun 2014 11:38:35 +0000
To: "bug-MooseX-Storage [...] rt.cpan.org" <bug-MooseX-Storage [...] rt.cpan.org>
From: Paumann Mario <Mario.Paumann [...] apa.at>
Hi ! We're using our own Storage traits with large ArrayRef of Moose Classes. We're used your Traits (e.g. OnlyWhenBuilt.pm) as an example which shows : $args{engine_traits} ||= []; push(@{$args{engine_traits}}, 'OnlyWhenBuilt'); $self->$orig(%args); This leads to performance problems due to the nature the %args of pack is 'arounded'. The following solved the problem : $self->$orig( %args, engine_traits => [ @{ $args{engine_traits} || [] }, 'PreserveUndef' ]); Explanation : For every Moose Object in the ArrayRef to be packed the the engine_traits List is extended because the %args ist _modified_ and so the @args of [ map { blessed($_) ? $OBJECT_HANDLERS{collapse}->($_, @args) : $_ } @$array ] Is modified too. If you find this useful you should modify your Traits the same way or maybe you have a better idea. Thank you, Mario