On 26 May 2011 14:23, William ML Leslie <[email protected]> wrote: > On 26 May 2011 14:15, Alex Gaynor <[email protected]> wrote: >> Well, IMO the issue is you can end up with a ton of guard_class that are >> more precise than you need, plus you have to manually specialize for each >> length, whereas with the other approach you can just automatically apply it >> to all tuples. > > With the class approach, you can store the length on the class, saving > some space for each object.
Also possibly relevant: The python tuple is intended to be a heterogeneous data structure, as they are in RPython. The length of a tuple is conceptually part of the type, which means that tuple length will be static in sane code anyway. I don't think this is over-specialisation, because for homogeneous usage of tuples we usually won't be talking about SmallTuples. I guess that it does have potential to blow up, and wonder if we already have a system for deoptimising the truly polymorphic case. -- William Leslie _______________________________________________ pypy-dev mailing list [email protected] http://mail.python.org/mailman/listinfo/pypy-dev
