[7b4471e] master: 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.

Chris Foster noreply at git.blender.org
Mon Feb 22 08:26:03 CET 2016


Commit: 7b4471e620748073ef3b2d68533a270ca4fbffa0
Author: Chris Foster
Date:   Mon Feb 22 02:17:56 2016 -0500
Branches: master
https://developer.blender.org/rBA7b4471e620748073ef3b2d68533a270ca4fbffa0

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.

===================================================================

M	io_scene_x/export_x.py

===================================================================

diff --git a/io_scene_x/export_x.py b/io_scene_x/export_x.py
index 08a7717..bde0fd2 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



More information about the Bf-extensions-cvs mailing list