develooper Front page | perl.perl5.porters | Postings from March 2000

Re: [PATCH 5.5.660] better avhv patch

Thread Previous | Thread Next
John Tobey
March 1, 2000 01:13
Re: [PATCH 5.5.660] better avhv patch
Message ID:
> Date: Mon, 28 Feb 2000 23:07:22 -0800
> From: Gurusamy Sarathy <>
> On Mon, 28 Feb 2000 22:13:31 EST, John Tobey wrote:
> >Here is a new version of the patch that avoids op.c and instead walks
> >the op tree at run time in pp_aassign.
> In general, walking the optree at run time is less desirable than
> compile time recognition.  I think your previous approach with
> ck_aassign() was better.

Hmm, okay.  It would be nice to be both correct and optimal.  How
about combining the two approaches?  I've tried detecting %{EXPR} on
the lhs at compile time and then combining its flag test in pp_aassign
with the existing OPpASSIGN_COMMON test...

    OP *leftop = Nullop;
    if (PL_op->op_private & (OPpASSIGN_COMMON|OPpASSIGN_HASH)) {
	if (PL_op->op_private & (OPpASSIGN_COMMON)) {
	    /* deal with OPpASSIGN_COMMON */
	if (!((PL_op->op_private & OPpASSIGN_HASH) &&
	    leftop = Nullop;

... but either this additional step

	if (leftop)
	    leftop = leftop->op_sibling;

or some other factor is keeping the benchmark about 10% slower for
stuff like this:

    scalar  => sub { ($a,$b,$c,$d,$e,$h) = () },

, even when leftop == 0, and even if leftop is declared register.

I am becoming discouraged in this effort.  The alternatives I see are
to put an array or bit vector in the assign op indicating which
elements are hashes (probably no better than the above) or to split it
all out in a new op AASSIGN_HEAVY function (not worth it).

Has Larry expressed strong feelings about the pseudohash?


John Tobey, late nite hacker <>
\\\                                                               ///
]]]             With enough bugs, all eyes are shallow.           [[[
///                                                               \\\

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