Add some comments concerning performance, probably not much to improve

This commit is contained in:
2026-03-02 17:12:22 +01:00
parent 3eed3e1058
commit fdc6bd3599
2 changed files with 5 additions and 1 deletions

View File

@@ -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

View File

@@ -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: