You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, triggering a topic requires two virtual calls:
First, the triggered Event will invoke trigger on each item on the topic starting from the next one. This works because topics are sorted such that events come first, then behaviors, so we don't have to waste time going through other events (usually there is only one).
Then we invoke the Function::operator(), which has to invoke a type-erased function wrapper by pointer.
The second one is theoretically impossible to remove because we need type erasure. The first one, however, could be removed if we used not a single covariant list containing both events and behaviors, but a list of events, where every event may contain its own list of behaviors. In this case, to trigger a topic, one will traverse the list of events, and for each event traverse its own list of behaviors. The number of traversed nodes will remain the same, but there will be only half as many virtual calls. The disadvantage is that event removal will become a rather complicated procedure, because if the removed event has any behaviors on its behavior list, they will have to be moved to another event. Also, the Event memory footprint will be larger because it will have to keep another list.
It is uncertain if this will actually work faster; benchmarking on an actual MCU is needed.
The text was updated successfully, but these errors were encountered:
Currently, triggering a topic requires two virtual calls:
First, the triggered
Event
will invoketrigger
on each item on the topic starting from the next one. This works because topics are sorted such that events come first, then behaviors, so we don't have to waste time going through other events (usually there is only one).Then we invoke the
Function::operator()
, which has to invoke a type-erased function wrapper by pointer.The second one is theoretically impossible to remove because we need type erasure. The first one, however, could be removed if we used not a single covariant list containing both events and behaviors, but a list of events, where every event may contain its own list of behaviors. In this case, to trigger a topic, one will traverse the list of events, and for each event traverse its own list of behaviors. The number of traversed nodes will remain the same, but there will be only half as many virtual calls. The disadvantage is that event removal will become a rather complicated procedure, because if the removed event has any behaviors on its behavior list, they will have to be moved to another event. Also, the
Event
memory footprint will be larger because it will have to keep another list.It is uncertain if this will actually work faster; benchmarking on an actual MCU is needed.
The text was updated successfully, but these errors were encountered: