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

Re: [perl #109542] $1 handled differently in integer arithmetics

Thread Previous | Thread Next
February 1, 2012 16:48
Re: [perl #109542] $1 handled differently in integer arithmetics
Message ID:
On 2 February 2012 00:48, Zefram <> wrote:
> demerphq wrote:
>>                                        Why don't we just copy the
>>values and be done with the bugs?
> Performance.  I'd be happy to lose a bit of performance for saner
> behaviour, but Reini will argue vehemently against it.  Between the
> two of us you'll find a range of opinions about which optimisations are
> worth the hassle.

I don't think this would actually be slower. I suspect it would be
faster, and make scripts that use the evil three $`, $&, $' much

Right now the rules for copying the string are that we copy it in
entirety if we see $1 or $2 in the pattern or have seen the evil three
anywhere in the script.

Anyway, I realized after i posted that LVALUES dont quite match, as
they dont preserve the LVALUE string when the target variable is
undef()'ed, or modified. If we could figure out a clean way to make
that happen, then the overhead would only be the creation of the
LVALUE SV, but we would eliminate a lot of string copying. AFAIK,
there have been a number of attempts  to add copy-on-write behaviour
to eliminate this copying and it has never quite worked out, and im
thinking that maybe LVALUE provides a neat way to make it work.


perl -Mre=debug -e "/just|another|perl|hacker/"

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