Building CPython

Chris Angelico rosuav at gmail.com
Fri May 15 11:06:58 EDT 2015


On Sat, May 16, 2015 at 1:00 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> On Fri, May 15, 2015 at 6:43 AM, Steven D'Aprano
> <steve+comp.lang.python at pearwood.info> wrote:
>> How much time would it save? Probably very little. After all, unless the
>> method call itself did bugger-all work, the time to create the method
>> object is probably insignificant. But it's a possible optimization.
>
> An interesting alternative (if it's not already being done) might be
> to maintain a limited free-list of method objects, removing the need
> to allocate memory for one before filling it in with data.

It is already done. Some stats were posted recently to python-dev, and
(if I read them correctly) method objects are among the free-list
types. So the actual memory (de)allocations are optimized, and all
that's left is setting a couple of pointers to select an object and a
function.

ChrisA



More information about the Python-list mailing list