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.
This commit is contained in:
parent
054ee2f417
commit
cb3f8ec4b1
|
@ -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
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue