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

Re: [PATCH 5.5.660] better avhv patch

From:
John Tobey
Date:
March 1, 2000 01:13
Subject:
Re: [PATCH 5.5.660] better avhv patch
Message ID:
m12Q5CC-000FRhC@feynman.localnet
> Date: Mon, 28 Feb 2000 23:07:22 -0800
> From: Gurusamy Sarathy <gsar@ActiveState.com>
> 
> 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?

Thanks
-John

-- 
John Tobey, late nite hacker <jtobey@john-edwin-tobey.org>
\\\                                                               ///
]]]             With enough bugs, all eyes are shallow.           [[[
///                                                               \\\



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About