develooper Front page | perl.perl5.porters | Postings from April 2010

Re: [PATCH] shift; optimization

Thread Previous | Thread Next
Vincent Pit
April 16, 2010 03:20
Re: [PATCH] shift; optimization
Message ID:
Thanks for this patch. At first glance it looks correct.

> In attachements you can find two patches that avoid using two
> additional OPs for shift and pop without argument. In the current
> blead ck_shift rebuilds the OP in this case and adds RV2AV(GV(@_ or
> @ARGV)) chain. Patches change that and use OPf_SPECIAL flag instead. I
> wrote two variants:
> 1) For @ARGV case old approach is used
> 2) op_private is used to choose between @ARGV and @_ later
> I prefer first variant, but it's up to you to decide:
I prefer the first variant as well.

You need to teach B::Deparse about your optimization, and test deparsing 
of "shift;" if it isn't already (and "pop;" as well, since 
ck_shift/pp_shift also handle pop).

A microbenchmark could also be interesting, so that we could put an 
attractive figure into perldelta.


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