A function is always going to be a lot more efficient in terms of code path length. Let’s compare to the two, what has to actually occur?
Everything here, is from an Assembler point of view, when I say instruction, I mean exactly that, there is in truth, no 1 to 1 relationship between assembly, and “high level languages”, for near every statement will generate 10’s if not 1000’s of assembly instructions. Many C compilers, actually generate assembler, and then have the assembler actually make the binary object.
Recoginize that a function is going to be called
Set up the Stack (i.e. information needed to return, passing paramerts (by reference or value)
Making the call (this is like, geezus, all of one instruction)
create the “message”
Set up the stack
Make the call to put the message into some form of queue, for delivery to all the available targets that are listening
Targets get the message (i.e. a function call, to enter into the target’s “code space” if you will
process the message
Deliver the message to the next target, ad nauseum
If the message is to actually generate a response, the we have to do this all over again, because no one knows who anyone is.
With a function, you know what is happening, with a message you can never be sure, unless your the one that is writing the underlying “messaging” system, or as with the Unreal engine you have access to the source code (gratz to Epic Games!), and have the time to look at the messaging system.
So as you can see, the message process is is a superset of the function process, some kind of function call (either to directly execute the code that you want to fire, or to just get a “message” into a queue for delivery) is going to ocurr. It just depends on your needs, and how much overhead your willing to force upon the game engine.
Anyway, just some more thoughts on the topic.