Raymond Hettinger <rhettin...@users.sourceforge.net> added the comment:
I'm working a better patch now. Will give to collin to review when it's ready. Here's a draft of the new opcode: TARGET(LOAD_CONST_ATTR) u = GETLOCAL(oparg); /* Cached attribute or NULL */ t = TOP(); /* t = (obj, name) where obj is constant */ if (u != NULL) { /* If cache is non-null, use it */ Py_INCREF(u); SET_TOP(u); Py_DECREF(t); FAST_DISPATCH(); } /* Cache is empty, do regular attribute lookup */ assert(PyTuple_CheckExact(t) && Py_SIZE(t) == 2); v = PyTuple_GET_ITEM(t, 0); w = PyTuple_GET_ITEM(t, 1); x = PyObject_GetAttr(v, w); Py_DECREF(t); if (x != NULL) { /* Successful lookup; cache it and return */ SETLOCAL(oparg, x); Py_INCREF(x); SET_TOP(x); break; } STACKADJ(-1); /* Attribute not found; goto err handler */ break; ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6133> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com