Hi there, I'm planning out an evolution simulator, and looking at hundreds (if not, then thousands) of creatures running around.

I'm wondering about the performance costs of relying on using Signals emitted from multiple input nodes per creature, as opposed to just using a loop and running functions to check for each input node's value instead.

I'm asking because I have noticed in other projects that if the CPU load is high, sometimes signals aren't caught by receivers, so having possibly thousands of signals being emitted possibly simultaneously will change behaviours.

Don't let the wi-fi looking icon for signals confuse you. It kind of suggests that signals are something that is constantly emitted, like radio signal. However, signals are just function (callback) calls.

So performance cost of a signal is exactly the same as the cost of a function call. It'll always be better to use signals than to iterate and check manually. The thing you can optimize is how frequently signals are emitted. Emit only when really necessary, use oneshot signals when sufficient and programmatically disconnect everything that's no longer needed.

It's not possible for properly connected signals not to be caught. Some other bugs probably prevent the signal-triggering conditions to happen.

Well signals are basically just function callbacks, so shouldn't be much heavier than a function call. However, I do believe there is some processing (at the very least to convert a string name to a function) but I can't imagine this is very expensive. However with thousands happening on the same frame, maybe there would be a measurable difference. I don't know.

In terms of signals getting lost, I haven't had that problem and I would be worried if that were the case. Since signals are basically functions, that would be akin to calling a function in code and having it not run, which would be a massive show stopper. If that is reproducible, you should submit a bug report because that may be a huge issue.

Thanks for that, I'll fret less.

Yeah, I noticed the signals not capturing when running a heavy virus scan (McAfee pft) so when the CPU is like 90%. But maybe it was a bug.

If framerate drops significantly, some of your collisions may not get registered because fast moving objects could "pass through" colliders in the (long) time span between the two frames. But this has nothing to do with signal mechanism itself.

a year later