mirror of
https://github.com/wassname/catalyst.git
synced 2026-09-09 11:19:23 +08:00
PERF: Remove alias_dt transform in favor of property on SIDData.
Adding a copy of the Event's dt field as datetime via the `alias_dt` generator, so that the API was forgiving and allowed both datetime and dt on a SIDData object, was creating noticeable overhead, even on an noop algorithms. Instead of incurring the cost of copying the datetime value and assigning it to the Event object on every event that is passed through the system, add a property to SIDData which acts as an alias `datetime` to `dt`. Eventually support for `data['foo'].datetime` may be removed, and could be considered deprecated.
This commit is contained in:
@@ -236,7 +236,7 @@ class BatchTransform(object):
|
||||
Point of entry. Process an event frame.
|
||||
"""
|
||||
# extract dates
|
||||
dts = [event.datetime for event in itervalues(data._data)]
|
||||
dts = [event.dt for event in itervalues(data._data)]
|
||||
# we have to provide the event with a dt. This is only for
|
||||
# checking if the event is outside the window or not so a
|
||||
# couple of seconds shouldn't matter. We don't add it to
|
||||
@@ -439,8 +439,7 @@ class BatchTransform(object):
|
||||
# with CUSTOM data events, there may be different fields
|
||||
# per sid. So the allowable keys are the union of all events.
|
||||
union = set.union(*sid_keys)
|
||||
unwanted_fields = set(['portfolio', 'sid', 'dt', 'type',
|
||||
'datetime', 'source_id'])
|
||||
unwanted_fields = set(['portfolio', 'sid', 'dt', 'type', 'source_id'])
|
||||
return union - unwanted_fields
|
||||
|
||||
def _get_field_names(self, event):
|
||||
|
||||
Reference in New Issue
Block a user