Python and the need for speed
greg.ewing at canterbury.ac.nz
Tue Apr 18 19:08:31 EDT 2017
> When considering special-casing this opcode sequence, remember that
> in-place operations can be performed on anonymous objects (i.e., those
> referenced by a collection and not bound directly to a namespace):
I think this means you would want multiple versions of the +=1 opcode:
ADD_ONE_TO_NAME, ADD_ONE_TO_ITEM, ADD_ONE_TO_ATTR, etc. Essentially
one for each variant of the STORE operation.
Or you might choose to optimise just the local name case, on the
basis that the overhead of things like item and attribute lookup
would probably swamp any possible gains.
More information about the Python-list