At 10:57 AM 5/8/2001 -0700, Peter Scott wrote:
>At 10:32 AM 5/8/01 -0700, Larry Wall wrote:
>>: One of the places I hope to gain some speed is in eliminating flattening
>>: and reconstitution of aggregate variables as much as possible. I'm hoping
>>: to exploit this really heavily to save both the memory for the flattened
>>: lists and the time it takes to flatten and reconstitute. (If we're really
>>: lucky we might even be able to rehome some of the underlying data
>>: structures, making returning a 10M entry hash cost about one pointer
>>: assignment)
>>
>>I suspect one way this saves us a lot of overhead is in knowing how
>>much memory to allocate for a given subroutine's stack frame.  The way
>>it is done in Perl 5, we pay the variadic stack overhead even on
>>subroutines that are known not to be variadic.  This is suboptimal,
>>since you have to be ready to extend the stack at any moment.  (It also
>>tends to pessimize linkage into pseudo-variadic languages like C.)
>
>Um, how do you know for sure a subroutine isn't variadic?  Even if it has 
>a fixed-length prototype, is Perl smart enough to know that it can't be 
>called as an object method, bypassing prototype checking?

Why assume that method calls will bypass prototype checking?

Larry and I were sort of talking about different things, too. I was 
contemplating the case of return values that looks like:

   sub bar {
     my @foo;
     $foo[time]=1;
     return @foo;
   }

while Larry seems to be talking about passing parameters into subs. Both 
are certainly issues, and related ones. (I'd not given passing parameters 
in much thought)

The optimizer's in a pretty good position to figure out exactly what you're 
doing if it's given enough time to do it in. By the time it gets the 
bytecode, there's not a whole lot of uncertainty left. (If I'm lucky, and 
yes I know we'll have stuff like $foo->$bar to contend with,  however the 
syntax ultimately goes)

                                        Dan

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

Reply via email to