[Bf-python] Vector data type
Martin Poirier
theeth at yahoo.com
Mon Sep 25 12:28:48 CEST 2006
--- Campbell Barton <cbarton at metavr.com> wrote:
> I was just looking and some areas for improvement.
> and found the vector pytype,
>
> typedef struct {
> PyObject_VAR_HEAD
> struct{
> float *py_data; //python managed
> float *blend_data; //blender managed
> }data;
> float *vec; //1D array of data
> (alias)
> int size;
> int wrapped; //is wrapped data?
> PyObject *coerced_object;
> } VectorObject;
>
>
> Looks like theres 3 areas for improvement.
> *vec; points to either *py_data; and *blend_data;
> depending on the
> wrapped; state.
> why not just remove *py_data; and *blend_data; and
> use vec only??
>
> int size;
> int wrapped; //is wrapped data?
>
> Could both be shorts? -would save 32bits, seems
> overkill again, 64 bits
> of data- for what is a total of 6 possible states.
>
> *coerced_object;
>
> - We could have vector math with floats and matrices
> without this.
>
> Anyone object to an attempt to optimize this struct
> for size?
I would object to any modifications that would
decrease the speed of vector manipulation operations.
So be sure to check that too. And be sure that you're
really reducing memory footprint, not just theorically
doing so.
Martin
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Bf-python
mailing list