<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | The idea is to create a special dictionary for python internals that | contains a pointer-to-a-pointer for the value side of the dictionary, | instead of just the standard PyObject*. Then when you start to eval a | code block, you could do a one-time lookup of the pointer-to-the- | pointer for each method, attribute, etc; and store them in pre- | allocated slots. The calls in the block to various GET_ and SET_ | functions can then just deal with pointer derefencing instead of a | dictionary lookup, and the dictionary can still get changed while this | is going on without things blowing up. | | I think you'd get a big speed up by changing all those dictionary | function calls to inlined pointer deref code. | | Anyone else buy this approach? Or see any fatal flaws?
Within CPython functions, local variables are usually implemented as numbered slots in a C array (of PyObject pointers). There is why a) the compiler makes a first pass thru a function body (to determine what is local and what is not) and b) LOAD_FAST is faster than LOAD_GLOBAL. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list