[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: [ID 19991223.005] simple optimiser bug in perl-5.005_63, sample



On Wed, Jan 05, 2000 at 10:58:17AM -0800, Gurusamy Sarathy wrote:
> >The fix for CONCAT happens to be simple: a check at run-time may
> >actually *speed* things up.  What remains is to decide what to do with
> >two other "dangerous" ops: OP_JOIN and OP_QUOTEMETA.  My guts say that
> 
> I've decided to disable the optimization for those two.  Let me know
> if/when someone figures out a _correct_ way to do it.

I will.

> > void
> >+Perl_sv_precatpvn(pTHX_ register SV *sv, register const char *ptr, register STRLEN len)
> >+{
> >+    STRLEN tlen;
> >+    char *junk;
> >+
> >+    junk = SvPV_force(sv, tlen);
> >+    SvGROW(sv, tlen + len + 1);
> >+    if (ptr == junk)
> >+	ptr = SvPVX(sv);
> >+    Move(SvPVX(sv),SvPVX(sv)+len,tlen,char);
> >+    Move(ptr,SvPVX(sv),len,char);
> >+    SvCUR(sv) += len;
> >+    *SvEND(sv) = '\0';
> >+    (void)SvPOK_only(sv);		/* validate pointer */
> >+    SvTAINT(sv);
> >+}
> 
> sv_insert() was meant to do what you're doing above, so why not use
> that?

Ignorance.  Additionally, this gives a shorter path through the forest
of conditional in sv_insert, so it has an added value too.

Ilya


References to:
Gurusamy Sarathy <gsar@ActiveState.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]