[pypy-dev] SmallTuples

Alex Gaynor alex.gaynor at gmail.com
Thu May 26 06:15:53 CEST 2011


On Wed, May 25, 2011 at 8:07 PM, Benjamin Peterson <benjamin at python.org>wrote:

> 2011/5/25 Alex Gaynor <alex.gaynor at gmail.com>:
> > I have a question about SmallTuples.  Why do we have multiple classes,
> > rather than doing the "hack" of mallocing a single block of memory for
> the
> > entirety of the object, since it is immutable and we can know the needed
> > space up front, CPython uses this "hack" for strs for example.
>
> What do you mean by that? Isn't having multiple classes the RPython
> equivalent of this hack?
>
>
>
> --
> Regards,
> Benjamin
>

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.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20110525/869783a0/attachment-0001.html>


More information about the pypy-dev mailing list