variable declaration

Nick Coghlan ncoghlan at iinet.net.au
Tue Feb 8 04:28:51 EST 2005


Antoon Pardon wrote:ons already existing.
> The compilor might generate a RESTORE instruction.

Whether it is done as a LOAD/STORE or a RESTORE, it has to perform the same work 
- check the name exists in the local namespace, and throw an exception if it 
doesn't. If it the name does exist, perform a normal store operation.

>>but the optimiser should 
>>eventually be able to do something to eliminate the performance penalty due to 
>>the technically unnecessary LOAD. I doubt it will be able to beat a STORE_FAST 
>>when it comes to trying to get a performance improvement, though :)
> 
> 
> But maybe a RESTORE_FAST could.

STORE_FAST is set up to store a local as fast as is reasonably possible. The 
space for the local is preallocated in the fast locals C array. How is an 
instruction which does that *and something else* ever meant to be faster?

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list