From cb3f8ec4b1c46e3130c9fb8f20cc8e892442c941 Mon Sep 17 00:00:00 2001 From: Mikhail Rachinskiy <mikhail.rachinskiy@gmail.com> Date: Wed, 15 Jul 2020 05:32:14 +0400 Subject: [PATCH] PLY: avoid list to dict conversion Use dictionary comprehension instead of converting list comprehension to dictionary. Gives around 2.5% speedup, and will probably scale in favor of dict comprehension. --- io_mesh_ply/import_ply.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/io_mesh_ply/import_ply.py b/io_mesh_ply/import_ply.py index 2bf914422..915368d7a 100644 --- a/io_mesh_ply/import_ply.py +++ b/io_mesh_ply/import_ply.py @@ -110,7 +110,12 @@ class ObjectSpec: self.specs = [] def load(self, format, stream): - return dict([(i.name, [i.load(format, stream) for j in range(i.count)]) for i in self.specs]) + return { + i.name: [ + i.load(format, stream) for j in range(i.count) + ] + for i in self.specs + } # Longhand for above LC """ -- GitLab