[Python-Dev] Proposed PEP: Optimizing Global Variable and Attribute Access

Roman Suzi rnd at onego.ru
Tue Aug 14 17:44:34 CEST 2001


On Tue, 14 Aug 2001, Skip Montanaro wrote:

>Let me know if that doesn't address your concerns.

Well, I just think that probably interpreter could
optimize by just IMPLICITLY making caching of global
references, like in this (current) optimization trick:

import os    # for constants

def f(x, y, z,   # normal atts
      cached_os_O_NONBLOCK=os.O_NONBLOCK,   # optimization trick
      cached ....
     )

    # here we use os.O_NONBLOCK, but interpreter uses
    # local _names_ and thus fast lookup.

That is, instead of tracking, simple implicit
localizing could be used, or not?

Only if the interpreter will be capable of determining which
references to objects need caching...

(I am not sure if ANY object could be FAST_LOADED.
I think, that memory is flat and thus this is the case.)

(Probably, I misunderstood the whole PEP and this is exactly what
is being proposed ;-)

Sincerely yours, Roman Suzi
-- 
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at onego.ru _/
_/ Monday, August 13, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "I distinctly remember forgetting that." _/





More information about the Python-list mailing list