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 @_?