diff options
author | Chris Foster <cdbfoster@gmail.com> | 2016-02-22 10:17:56 +0300 |
---|---|---|
committer | Chris Foster <cdbfoster@gmail.com> | 2016-02-22 10:17:56 +0300 |
commit | 7b4471e620748073ef3b2d68533a270ca4fbffa0 (patch) | |
tree | fda2093a8e66b18b6d6d49724bc67a92031d59c8 | |
parent | bdb3dd8ab34ee487e1791243aed594085bbcf965 (diff) |
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.
-rw-r--r-- | io_scene_x/export_x.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/io_scene_x/export_x.py b/io_scene_x/export_x.py index 08a77176..bde0fd26 100644 --- a/io_scene_x/export_x.py +++ b/io_scene_x/export_x.py @@ -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 |