develooper Front page | perl.perl5.porters | Postings from October 2014

Re: Single-item padrange?

Thread Previous | Thread Next
Steffen Mueller
October 18, 2014 20:05
Re: Single-item padrange?
Message ID:

On 10/18/2014 07:06 PM, Father Chrysostomos wrote:
> Steffen Mueller wrote:
>> On 10/18/2014 06:56 AM, Father Chrysostomos wrote:
>>> BTW, a simplistic benchmark like this shows a 10% speed increase with
>>> the list+pushmark optimisation disabled:
>>> $ time ./miniperl -e 'for(1..20000000){() = (0,my($b,$c))}'
>> Do you have any idea if this might be also relevant to code that's not
>> completely contrived?
> No, not in blead.  (Nor can I think of a non-contrived example where
> your list+pushmark-in-list-context optimisation helps.  If you could
> provide one, that would help put things in perspective.)

Examples: Slices, certain map expressions (if they return more than one 

See also: (a 
bit drawn out in explanations for you, sorry).

> But if I move the list+pushmark optimisation to
> the context-application phase as proposed in
> <>, then it would
> affect code like map { $this_lexical, $that_lexical, ... }, which is
> admitted still contrived, though I can imagine it being more likely to
> happen in the wild than (0,my($a,$b)).

I don't think that's so contrived at all, by the way. Extending lists 
with map isn't so uncommon.

Best regards,

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About