[Python-Dev] Optimization targets - refcount

"Martin v. Löwis" martin at v.loewis.de
Sat Apr 17 18:18:33 EDT 2004


Mike Pall wrote:
> What I meant with 'less malloc-happy' is that we should try to reduce
> the number of allocations/deallocations for internal (!) objects (I'm not
> talking about objects explicitly managed by the application). Many of them
> have a very short time-to-live. I guess some of them could be recycled or
> even optimized away.
> 
> E.g. global profiling indicates that tuple allocation/deallocation has a
> noticeable effect on performance. There are probably other objects that
> have prohibitive setup/teardown cost (but are less pronounced on allocation
> costs).

The problem is that this has already been done in the past. Anybody
contributing to the Python core is certainly aware that avoiding memory
allocations, where possible, should be done, and indeed, special cases
have been added (e.g. my addition of METH_NONE and METH_O to avoid
tuple creation).

So unless a specific proposal is made, I'm doubtful that much
optimization is possible without breaking core semantic aspects
of the language.

Regards,
Martin




More information about the Python-Dev mailing list