[Python-Dev] Speeding up instance attribute access
Neal Norwitz
neal@metaslash.com
Fri, 08 Feb 2002 16:10:25 -0500
Fri, 08 Feb 2002 16:10:25 -0500
- Previous message: [Python-Dev] Speeding up instance attribute access
- Next message: [Python-Dev] Speeding up instance attribute access
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum wrote: > - The required global analysis is a bit hairy, and not something we > already do. I believe that Jeremy thinks PyChecker already does > this; I'm not sure if that means we can borrow code or just ideas. The algorithm pychecker uses is pretty simple. I think something like this should work: for each method: self = method.co_varnames[0] for each byte code in method: if op == STORE_FAST and oparg == self: break # we don't know self anymore if (op == STORE_ATTR or op == LOAD_ATTR) and selfOnTop: # we have an attribute store it off selfOnTop = (LOAD_FAST and oparg == self) Note that storing the attributes could be done during the compilation step. This means that it should be simple housekeeping in the compiler to store the info and not require another pass (as in pychecker). Neal
- Previous message: [Python-Dev] Speeding up instance attribute access
- Next message: [Python-Dev] Speeding up instance attribute access
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]