[Python-Dev] Proposal to eliminate PySet_Fini (original) (raw)
Jack Diederich jack at psynchronous.com
Tue Jun 27 20:44:05 CEST 2006
- Previous message: [Python-Dev] Proposal to eliminate PySet_Fini
- Next message: [Python-Dev] Proposal to eliminate PySet_Fini
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Jun 27, 2006 at 02:09:19PM -0400, Alexander Belopolsky wrote:
Setobject code allocates several internal objects on the heap that are cleaned up by the PySetFini function. This is a fine design choice, but it often makes debugging applications with embedded python more difficult.
I propose to eliminate the need for PySetFini as follows: 1. Make dummy and emptyfrozenset static objects similar to PyNone 2. Eliminate the free sets reuse scheme. The second proposal is probably more controversial, but is there any real benefit from that scheme when pymalloc is enabled?
These are optimizations and not likely to go away. tuples especially get reused frequently. In the case of tuples you can #define MAXSAVEDTUPLES to zero in a custom python build to disable free-listing. You can submit a patch that #ifdef'd the other free list in a similar way (sets don't currently have the ifdef check, for instance) and hope it gets accepted. I don't see why it wouldn't.
PyObject_MALLOC does a good job of reusing small allocations but it can't quite manage the same speed as a free list, especially for things that have some extra setup involved (tuples have a free list for each length).
-Jack
- Previous message: [Python-Dev] Proposal to eliminate PySet_Fini
- Next message: [Python-Dev] Proposal to eliminate PySet_Fini
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]