diff options
author | Mikhail Rachinskiy <mikhail.rachinskiy@gmail.com> | 2020-07-15 04:32:14 +0300 |
---|---|---|
committer | Mikhail Rachinskiy <mikhail.rachinskiy@gmail.com> | 2020-07-15 04:32:14 +0300 |
commit | cb3f8ec4b1c46e3130c9fb8f20cc8e892442c941 (patch) | |
tree | 1d1ac8333c8715801d340d41be6ed899139806a5 /io_mesh_ply | |
parent | 054ee2f41734049c9ba1386d9ec9eb3e85fc2e3f (diff) |
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.
Diffstat (limited to 'io_mesh_ply')
-rw-r--r-- | io_mesh_ply/import_ply.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/io_mesh_ply/import_ply.py b/io_mesh_ply/import_ply.py index 2bf91442..915368d7 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 """ |