Reduce reallocations by using lists instead of tuples. This yields massive performance improvements when exporting large files. Thanks to Rafał Brzeżański for pointing this out.

This commit is contained in:
Chris Foster 2016-02-22 02:17:56 -05:00
parent bdb3dd8ab3
commit 7b4471e620
1 changed files with 4 additions and 3 deletions

View File

@ -427,10 +427,11 @@ class MeshExportObject(ExportObject):
def __init__(self, Mesh):
MeshExportObject._MeshEnumerator.__init__(self, Mesh)
self.vertices = tuple()
self.vertices = []
for Polygon in Mesh.polygons:
self.vertices += tuple(Mesh.vertices[VertexIndex]
for VertexIndex in Polygon.vertices)
self.vertices += [Mesh.vertices[VertexIndex]
for VertexIndex in Polygon.vertices]
self.vertices = tuple(self.vertices)
self.PolygonVertexIndices = []
Index = 0