Skip Menu |

This queue is for tickets about the Moo CPAN distribution.

Report information
The Basics
Id: 82537
Status: resolved
Priority: 0/
Queue: Moo

People
Owner: Nobody in particular
Requestors: ribasushi [...] leporine.io
Cc:
AdminCc:

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



Subject: Stateless defaults really inefficient
has max_retried_count => ( ... default => sub { 20 } ...) generates: $new->{"max_retried_count"} = ( exists $args->{"max_retried_count"} ? $args->{"max_retried_count"} : $default_for_max_retried_count->($new) ); switching to ... default => quote_sub( '20' ) ... is no better: $new->{"max_retried_count"} = ( exists $args->{"max_retried_count"} ? $args->{"max_retried_count"} : do { local @_ = ($new); 20 } ); in fact the localization of @_ seems to be some microsecs slower. Can haz something more efficient? Perhaps quote_sub_constant(), signaling ability to unconditionally inline without setting @_?
On Mon Jan 07 07:39:30 2013, RIBASUSHI wrote: Show quoted text
> Perhaps quote_sub_constant(), > signaling ability to unconditionally inline without setting @_?
That is if you are still firmly against the more straightforward variant to allow non-refs as-is.
The latest Moo allows non-ref defaults to be used directly. That should mitigate most of this issue.
The latest Moo removes the rest of the non-essential output for quote_sub'd defaults. I think that qualifies as fixing this, so I'm marking it resolved.