mirror of
https://github.com/wassname/catalyst.git
synced 2026-09-30 11:23:20 +08:00
Uses dictionary update instead of iterating through keys.
update_universe is a bottleneck on large data sets. A large portion of that bottleneck is the call to getitem while looping over the keys, so using update while passing along the internal __dict__ Seeing about a 40% improvement.
This commit is contained in:
1 parent
dd64bb0fbf
commit
0d841503a7
1 file changed
+1
-2
@@ -241,8 +241,7 @@ class AlgorithmSimulator(object):
|
||||
self.algo.set_portfolio(event.portfolio)
|
||||
|
||||
# Update our knowledge of this event's sid
|
||||
for field in event.keys():
|
||||
self.universe[event.sid][field] = event[field]
|
||||
self.universe[event.sid].update(event.__dict__)
|
||||
|
||||
def simulate_snapshot(self, date):
|
||||
"""
|
||||
|
||||
Reference in new issue
Block a user