Hi Paolo, On 08/21/2010 01:46 AM, Paolo Giarrusso wrote: [...] > Your mention of slots is very cool! You made me recall that once you > get shadow classes in Python, you can not only do inline caching, but > you also have the _same_ object layout as in slots, because adding a > member causes a hidden class transition, getting rid of any kind of > dictionary _after compilation_. Two exceptions: > * an immutable dictionary mapping field names to offsets is used both > during JIT compilation and when inline caching fails, for > * a fallback case for when __dict__ is used, I guess, is needed. Not > necessarily a dictionary must be used though: one could also make > __dict__ usage just cause class transitions. > * beyond a certain member count, i.e., if __dict__ is used as a > general-purpose dictionary, one might want to switch back to a > dictionary representation. This only applies if this is done in > Pythonic code (guess not) - I remember this case from V8, for > JavaScript, where the expected usage is different. >
Just as a note: PyPy's Python interpreter does all this already, and I am working on making it even cooler :-). [...] Cheers, Carl Friedrich _______________________________________________ [email protected] http://codespeak.net/mailman/listinfo/pypy-dev
