[Python-Dev] Re: opcode performance measurements

Jeff Epler jepler@unpythonic.dhs.org
Thu, 31 Jan 2002 14:17:25 -0600


On Thu, Jan 31, 2002 at 05:14:28AM -0500, Jeremy Hylton wrote:
> PS Skip-- Sorry the PEP isn't clear, but the only dictionary lookups
> that need to occur are at function creation time.  MAKE_FUNCTION would
> need to lookup the offsets of the globals used by the functions, so
> that a LOAD_FAST_GLOBAL opcode would take an int argument.

So how does this work for mutually-recursive functions?
    def f(x):
	if x==1: return 1
	return g(x)

    def g(x): return x * f(x-1)

can f not optimize the load of the global g into a LOAD_FAST_GLOBAL?

Jeff
PS Which PEP?  I only see 266