The Cost of Event Dispatchers?

Tried to find informations about the cost of Event Dispatcher listeners but didn’t find anything deep about this topic. For me it is not clear, if the listeners do need constant CPU-Time while waiting for the call (waiting every tick?). If you have 50 Actor-Blueprints binded to the call - do they need extra CPU-Time for their active listening or do listeners wait passive without cost? Maybe it is not a good idea, to inform 50 Actors about an event via Event Dispatcher because all 50 need CPU-Time for their waiting? This is the question i’m asking myself for a few days now. Maybe somebody has some deeper informations about this topic?

1 Like

Why not test it and profile it? Put an event dispatcher on your player pawn and call it, create another BP and bind to the event dispatcher, put 50 of them in the level, then check the difference between binding to the event dispatcher 50 times and not binding at all.

I don’t actually know what i’m talking about, but i think that event dispatchers are just an array of functions to call. When you bind to an event dispatcher, you’re just adding the function you bound to it to the array. and when you call the event dispatcher, it goes through each of the functions in the array and calls them.

UMG widgets work the way you “don’t want it to be”; they query for property state every frame for the ones they have fields attached to.
But dispatchers do nothing, until the event is firing telling them to “wake up” and execute.

1 Like

Take a look at the Observer pattern Observer pattern - Wikipedia

Thank you for your quick answers. Cyaoeu - you are right, testing and profiling is always a good method to finding something out. But sometimes a question might be faster to help clarify things - so i gave it a try :wink:
Ispheria - the event dispatcher sender sends out the call and doesn’t care if something is listening, then each listener executes its own individual custom event. I was wondering if they listen with constant CPU cost or with no cost.
BrUnO - great to read that the listeners listen with no constant CPU cost. This makes event dispatchers to the perfect tool for my workflow :slight_smile:

4 Likes