At 01:33 PM 2/12/2001 -0500, Sam Tregar wrote:
>On Mon, 12 Feb 2001, Dan Sugalski wrote:
>
> > >I think I've heard you state that before.  Can you be more specific?  What
> > >alternate system do you have in mind?  Is this just wishful thinking?
> >
> > This isn't just wishful thinking, no.
>
>You picked the easy one.  Maybe you can get back to the other two when you
>have more time?

That is the plan, yes.

> > Code flow analysis can get an awful lot. Some help from the runtime will
> > get the rest.
>
>Do you mean that you can tell from a compile-time flow-control graph
>exactly when DESTROY needs to be called for every object?  What kind of
>help from the runtime?  Reference counting help?

Every object? No. Most objects? Yes. For this code:

   {
     my $foo = new Some::Thing;
     $foo->whatever;
   }

it's pretty obvious in many cases where $foo needs finalization. (Those 
cases where it isn't include the ones where the whatever method gets 
redefined at runtime, or where there's an eval/do/require without a "static 
assumptions OK" flag set somewhere)

Runtime support for this would include things like the assign vtable method 
for blessed references to finalizable things adding an entry to the "check 
me for cleanup or hoist me out" list for the home block of the variable 
getting the reference assigned to.

> > It's reasonably obvious (which is to say "cheap") which variables aren't
> > involved with anything finalizable.
>
>Probably a simple bit check and branch.  Is that cheap?  I guess it must
>be.
>
> > Nowhere near double the penalty. We only need to deal with refcounts when
> > references are actually taken, assigned, or destroyed. That's a rare
> > occurrence, relatively speaking.
>
>Perhaps.  It's not rare in OO Perl which is coincidentally one area in
>serious need of a speedup.  I suppose I'm warped by my own experience -
>all the code I see every day is filled with references and objects.
>That's probably not the average case Perl usage.

It *is* rare in OO perl, though. How many of the variables you use are 
really, truly in need of finalization? .1 percent? .01 percent? Less? Don't 
forget that you need to count every scalar in every array or hash, and 
every iteration over a block with my declarations. Perl churns through a 
*lot* of SV pointers in its average run, and most of them aren't in need of 
finalization.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to