Reducing allocations in more places can be done by changing now
Vec2f_ptr_from_PyObject, Vec2f_ptr_from_Vector,
Vec3f_ptr_from_PyObject, Vec3r_ptr_from_PyObject ... etc work.

Just change them to accept the vector as an arg

Vec3r *Vec3r_ptr_from_PyObject(PyObject *obj)
... to ...
bool Vec3r_ptr_from_PyObject(PyObject *obj, Vec3r *vec)
{
   /* set vec->x,y */
   return success;  /* false == py-exception */
}

this way the caller can choose to use vectors on the stack (which is
fine in most cases), and only use the heap when its needed.
_______________________________________________
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers

Reply via email to