develooper Front page | perl.perl5.porters | Postings from February 2011

[perl #82110] Still "keys" performance regression between 5.10.1 and 5.12.3-RC1

Thread Next
From:
Father Chrysostomos via RT
Date:
February 6, 2011 13:07
Subject:
[perl #82110] Still "keys" performance regression between 5.10.1 and 5.12.3-RC1
Message ID:
rt-3.6.HEAD-30148-1297026444-372.82110-15-0@perl.org
On Tue Jan 18 06:53:20 2011, davem wrote:
> On Sun, Jan 16, 2011 at 01:28:11PM -0800, Father Chrysostomos via RT
wrote:
> > An expression like ‘my @array = ...’ might also reference @array on the
> > right hand side (if named subroutine closes over @array and its return
> > value is on the rhs), so the no-common-vars optimisation is disabled for
> > ‘my @array =’.
> 
> But we should be able to tell whether the lexical is closed over by its
> reference count:
> 
> $ p -MDevel::Peek -we'my $x; Dump $x'
> ALLOCATED at -e:1 for padsv (parent 0x0); serial 1763
> SV = NULL(0x0) at 0x2171f80
>   REFCNT = 1
>   FLAGS = (PADMY)
> 
> $ p -MDevel::Peek -we'my $x; Dump $x; sub f {$x+1}'
> ALLOCATED at -e:1 for padsv (parent 0x0); serial 1763
> SV = NULL(0x0) at 0x283ef90
>   REFCNT = 2
>   FLAGS = (PADMY)

At compile time, the OPpASSIGN_COMMON flag is set when the list
assignment is compiled. If the list assignment comes before the
subroutine that closes over the lexical, it’s not possible to know at
that time.
It’s not possible to use a reference count in pp_aassign, either,
because the stack is not reference-counted. (I tried that and got an
incredible speed-up, but ($a,$b)=($b,$a) stopped working.)


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