Continuing on as3-signals. Here the guy actually ran performance tests on as3-signals vs. events. And got surprisingly SHOCKING results. You won’t gonna believe — AS3-SIGNALS ARE FASTER THAN EVENTS!!!!!1 Who could have thought that, huh? OK, </sarcasm>. Just looking at the code you can tell that as3-signals being simpler will be faster. This is definitely good.
But, if you need 0(zero) or 1(one) listener for your object, use plain old callbacks and you will be shocked by performance boost!
I added this code to the guy’s test:
public var callback:Function;
public function dataCallback():void
{
for (var i:uint = 0; i < loops; i++)
this.callback(i);
}
And here are the results
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
1 (5 iterations)
Player version: MAC 10,0,42,34 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
Events 3107 621.40
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
1 (5 iterations)
Player version: MAC 10,0,42,34 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
Signals 2198 439.60
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
1 (5 iterations)
Player version: MAC 10,0,42,34 (debug)
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
method...................................................ttl ms...avg ms
Callback 255 51.00
––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
Someone has too much time running tests and drawing graphs. Oh wait, it’s me. At least I haven’t drawn a graph.
P.S. Once again, as3-signals is good, opensource is good! cheers~













As it happens, I wrote the performance test code at the behest of a couple of other coders who were interested in the results. It might have been useful to compare it with callbacks, but my difficulty with callbacks are that they are less manageable over large projects. Thank you for adding a comparison with callbacks.
The purpose of my producing graphs was to demonstrate the relative speed differences at a casual glance. You might have poured scorn over my choice of graph: 3D? I was careful to say explicitly that you shouldn’t take my results as scientific, so the graphs are purely illustrative. They are easier to read, and allow busy developers (who are the vast majority of people who look at my blog) to understand the results as quickly as possible.
Other than that, I find your tone unreasonable and offensive. Certainly I didn’t say anything stupid, even if it is trivial. I didn’t claim that my results were original, that they were important or that they deserved attention. Of all the posts on the internet that your bile could have been targeted towards, I find it really strange that you should aim it at mine.
The Debug Player isn’t the best for measuring performance.
Indeed. But callbacks will be faster anywhere.
Haha! No, callbacks can be slower than signals.
You forgot one essential part – to check “if (callback != null)”. In a real program, half of the times callbacks are null, and for null cases my signals code is 3+ times faster than callbacks.
С колбэками это хорошо, Вы, Валентин, стебок :)
http://jacksondunstan.com/turbosignals