Add some comments concerning performance, probably not much to improve
This commit is contained in:
@@ -46,6 +46,8 @@ EVENT_BITMASKS = {
|
||||
}
|
||||
|
||||
def append_fields(input: np.recarray, new_fields: List[Tuple[str, np.dtype]]):
|
||||
# TODO: This action is used often and time consuming as it runs len(flds) times over all indices.
|
||||
# Could only be faster if array is allocated in the beginning with all fields, less flexible.
|
||||
# add one ore more fields to a recarray, numpy functions seems to fail
|
||||
flds = [(name, dtypei[0]) for name, dtypei in input.dtype.fields.items()]
|
||||
flds += new_fields
|
||||
|
||||
@@ -165,7 +165,9 @@ class ApplyMask(EventDataAction):
|
||||
self.bitmask_filter = bitmask_filter
|
||||
|
||||
def perform_action(self, dataset: EventDatasetProtocol) ->None:
|
||||
# TODO: why is this action time consuming?
|
||||
# TODO: Most time in test examples is spend here.
|
||||
# While the actions here are very simple, they act on a large array,
|
||||
# so even just comparison and indexing become time consuming.
|
||||
d = dataset.data
|
||||
pre_filter = d.events.shape[0]
|
||||
if logging.getLogger().level <= logging.DEBUG:
|
||||
|
||||
Reference in New Issue
Block a user