mirror of
https://github.com/wassname/catalyst.git
synced 2026-07-27 11:20:45 +08:00
PERF: Remove deepcopy from EventWindow ticks.
The deepcopy of events into the EventWindow's ticks was causing a significant increase in memory consumption, e.g. an algorithm with almost 200 sids and 14 vwaps removing the deepcopy reduces the amount of memory consumed by about 40%. The downside is that if an event's properties are changed, which is not advised, later on, then the signal derived from vwap etc. may be changed.
This commit is contained in:
@@ -23,7 +23,6 @@ import logbook
|
||||
|
||||
from numbers import Integral
|
||||
|
||||
from copy import deepcopy
|
||||
from datetime import datetime
|
||||
from collections import deque
|
||||
from abc import ABCMeta, abstractmethod
|
||||
@@ -216,7 +215,7 @@ class EventWindow(object):
|
||||
|
||||
self.assert_well_formed(event)
|
||||
# Add new event and increment totals.
|
||||
self.ticks.append(deepcopy(event))
|
||||
self.ticks.append(event)
|
||||
|
||||
# Subclasses should override handle_add to define behavior for
|
||||
# adding new ticks.
|
||||
|
||||
Reference in New Issue
Block a user