[Cython] Storing many, many instances

Dag Sverre Seljebotn dagss at student.matnat.uio.no
Wed May 6 14:10:55 CEST 2009


Stefan Behnel wrote:
> Robert Bradshaw wrote:
>> We should
>> look into making instantiating (cdef) classes faster by default as well.
> 
> Different topic, but surely worth it (and worth a ticket). It might work
> to always use PY_NEW() for instantiation and then generate a separate (and
> direct) call to __init__() only if the type defines it.

Should one consider allocating arrays of cdef class objects as one big 
memory block? I would think that allocating first and then run a 
constructor N times would be faster than N allocations.

-- 
Dag Sverre


More information about the Cython-dev mailing list