diff options
author | Campbell Barton <ideasman42@gmail.com> | 2006-10-03 09:11:33 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2006-10-03 09:11:33 +0400 |
commit | 6b7c4e09e8e1051e89b7a93d998810657b8a93e9 (patch) | |
tree | dae832f5f8be22117878b2060fbc2ce1b6bd0e02 /source/blender/python/api2_2x/vector.h | |
parent | 815f115338aa960b3bf9451abb20b238d3308dd0 (diff) |
Mathutils.Vector speedup
removed the need for casting python objects to Vectors pyobjects when performing vec/float arithmatic.
a PyObject for coercing has also been removed from the vector struct so a little less memory will be used also.
Benchmarked before and after this change
___________________________________
import Blender
v= Blender.Mathutils.Vector
m= Blender.Mathutils.Matrix
a= v(1,2,3)
b= v(3,2,1)
c= m()
t= Blender.sys.time()
for i in xrange(20000000):
a*b
a*10
a/10
a+b
b-a
a*c
print Blender.sys.time()-t
_______________________________________
Before 63.5sec
after 49.5
about 3 sec of that is looping
Diffstat (limited to 'source/blender/python/api2_2x/vector.h')
-rw-r--r-- | source/blender/python/api2_2x/vector.h | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/vector.h b/source/blender/python/api2_2x/vector.h index f66d003ef11..94ac10cac15 100644 --- a/source/blender/python/api2_2x/vector.h +++ b/source/blender/python/api2_2x/vector.h @@ -48,7 +48,6 @@ typedef struct { float *vec; //1D array of data (alias) int size; int wrapped; //is wrapped data? - PyObject *coerced_object; } VectorObject; /*coerced_object is a pointer to the object that it was coerced from when a dummy vector needs to be created from |