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

Re: Single-item padrange?

Thread Previous | Thread Next
Father Chrysostomos
October 18, 2014 17:06
Re: Single-item padrange?
Message ID:
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.)

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

Another advantage is that it would allow the same logic for this opti-
misation whether it is in list or void context.  In 8717a761ed I
extended it to void context to benefit 'our($a,$b);', but was careful
not to disable padrange in 'my($a,$b);'.

> Maybe I'm being insufficiently creative, but this
> seems like a corner case that shouldn't be at the forefront of
> optimization efforts. Sorry if I'm just being dense. :)

On the contrary, it's that type of question that makes me take a step
back and consider whether I'm not just building an ivory tower.

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