Cage opened this issue on Dec 20, 2006 · 1232 posts
Spanki posted Thu, 13 March 2008 at 2:28 PM
[dont't_freak_out]
...the biggest problem (IMO) with what we're doing currently (lists-of-lists-of-floats) is the shamefull amount of memory being used. Note that each 'float' (x, y, z) is itself a PyObject, which is made up of:
int ob_refcnt; 4 bytes
struct _typeobject *ob_type; 4 bytes for pointer, plus huge amount for the structure itself
double ob_fval; 8 bytes
...so each float has it's own _typeobject allocated for it (roughly 20 pointers (4 bytes each) to other structures of various size, plus what may be another 2 dozen pointers to function calls), along with the additional 8 bytes for the refcnt and pointer.
We probably can't get away from the _typeobject per vertex, but if there was a 'vertex type' in Python (surely someone has already made an extension somewhere ?), we could at least save the 2 extra.
[/dont't_freak_out]
I'll investigate this more when I have more time.
Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.