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

Re: Single-item padrange?

Thread Previous | Thread Next
From:
Steffen Mueller
Date:
October 18, 2014 20:05
Subject:
Re: Single-item padrange?
Message ID:
5442C801.2050602@cpan.org
Hi,

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 
element).

See also: 
http://blog.booking.com/more-optimizations-in-perl-5.20-to-be.html (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
> <20141017162522.32689.qmail@lists-nntp.develooper.com>, 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,
Steffen

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About