At 10:33 PM 6/11/2001 -0500, David L. Nicol wrote:
>[EMAIL PROTECTED] wrote:
>
> > You may wish to read this thread about lazy arrays and object
> > persistence to get an idea of what you're getting into.
> > http://www.geocrawler.com/archives/3/3024/2001/3/0/5427925/
>
>Taking lazy as far as we can, has anyone been thinking about
>a compilation mode in which all expensive accesses get deferred until
>there is a decision to be made?

Yup, I seriously considered this when all the lazy stuff cropped up ages 
ago. It could give all sorts of speed boosts when dealing with large arrays 
and hashes in addition to the function calls. It runs afoul of perl's 
active data, though, which is kind of a bummer.

Bits of this will be used by the compiler and runtime, if for no other 
reason than to make this:

   ($foo, $bar) = <BAZ>;

or this:

    $#bar = 10e6;
    ($foo, $baz) = @bar;

more efficient. (In the first case we read two lines then seek to EOF (if 
that's what <> in list context will still do in perl 6) and in the second 
we just grab the first two elements of @bar rather than dumping the whole 
darned thing on the stack and plucking off the first elements)

I'm still trying to formulate a good set of rules on how I think active 
data should perform under optimization to pass on to Larry.


                                        Dan

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

Reply via email to