[Bf-python] Python API refactoring wiki
Ken Hughes
khughes at pacific.edu
Fri Jan 27 07:37:23 CET 2006
jmsoler at free.fr wrote:
> Selon jmsoler at free.fr:
>
>
>>Selon Campbell Barton <cbarton at metavr.com>:
>>
>>
>>>Hey Guys, started a wiki page for python api refactoring.. check it out.
>>>http://mediawiki.blender.org/index.php/BlenderDev/BpyApiDiscussion
>>>
>>
>>About this :
>>" Will we maintain NMesh? (seems like a good time to get rid of it)",
>>just a word, create a simple vertex with Mesh is 60/70 times slower
>>than with NMesh .
>
>
> Comparison script :
> http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_MeshvsNMesh.htm
OK, that's understandable; appending vertices/edges/faces one at a time
is extrememly inefficient. Each time extend() is called, the a new
structure has to be alloced, the existing data copied, and the new vert
appended to the end.
For adding new verts/edges/faces, the intent is to put all the items
into sequence, then call extend():
for i in range(LIM):
verts=[]
for i in range(LIM):
verts.append((Noise.random()*DIM,
Noise.random()*DIM,Noise.random()*DIM))
me.verts.extend(verts)
Written this way, my timings show Mesh to be about 20% faster than NMesh.
Ken
More information about the Bf-python
mailing list