develooper Front page | perl.perl6.internals | Postings from February 2001

Re: PDD 2, vtables

Thread Previous | Thread Next
February 7, 2001 10:00
Re: PDD 2, vtables
Message ID:
Dan Sugalski wrote:
> At 03:09 PM 2/7/2001 +0000, David Mitchell wrote:
> >A mere detail, but would it not be more efficient to just pass them
> >as extra args, ie add(PMC1, PMC2, PMC3, key1, key2, key3),
> >rather than having to potentially create and populate a tmp struct
> >just to call the function???
> Well, extra arguments cost. I'd originally had only a single key
> passed in, but that meant potentially two of the three PMCs had to be
> rather than keyed into containers. (And thus possibly virtual) Hence the
> key array.
> I admit it's not a swell decision--I'm not sure whether the single
> parameter is better, or several optional (or required) parameters are
> better. I can see it going either way, and I didn't put all that much
> thought into it.

I think filling an array costs at least as much as passing parameters, not
to mention the cost of passing that array as a parameter, also... Unless the
array is constant and can be pre-filled by the compiler (which I think is a
somewhat rare case, considering all the three arguments), or once filled
there are cases it can be reused, I'm not sure it's worth using an array to
save 2 pushes into the stack...

- Branden

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