Benchmark: Flash Events vs. Signals

0 Flares Twitter 0 Facebook 0 Google+ 0 Pin It Share 0 Email -- Filament.io 0 Flares ×

You may be wondering why a new benchmark for this. Well, I have three reasons:

  1. all of the other benchmarks I could find on internet were outdated
  2. I always prefer to test things for myself
  3. as I always test things for myself, I took some time to write a little benchmark tool that will be used for more benchmarks and that also allows me to test them on future releases of flash, very quickly

Here it is:

Get Adobe Flash player

Quick resume of my results

Signals seem to be faster than Flash Events in most cases. But I sometimes have strange results, like a Signal with no argument is sometimes slower than a Signal with 1 or more arguments. Also if you try with a low iteration number (1000 for me), you might have incoherent results (compared with a higher iteration number).
It’s also important to notice that when we have 4 and more arguments (with Signals), the time suddenly increases more than when comparing Signals with 2 and 3 arguments. A quick look at the code and we can see that there is a small optimization going on there, but only for up to 3 arguments.

Don’t hesitate to post your results (you can click on the “Copy results to clipboard” and paste it in the comment)

0 Flares Twitter 0 Facebook 0 Google+ 0 Pin It Share 0 Email -- Filament.io 0 Flares ×

3 Comments

  1. my results:
    Signals (1 argument, 0 listeners): 0.028
    Events (0 argument, 0 listeners): 0.051000000000000004
    Signals (3 arguments, 10 listeners): 0.112
    Signals (1 argument, 10 listeners): 0.114
    Signals (0 argument, 10 listeners): 0.12
    Signals (2 arguments, 10 listeners): 0.122
    Signals (4 arguments, 10 listeners): 0.186
    Signals (5 arguments, 10 listeners): 0.20500000000000002
    Events (0 argument, 10 listeners): 0.504

  2. and an other one, different results there, but Flash Events are always slower:
    Signals (1 argument, 0 listeners): 0.027
    Events (0 argument, 0 listeners): 0.049
    Signals (0 argument, 10 listeners): 0.08700000000000001
    Signals (1 argument, 10 listeners): 0.088
    Signals (2 arguments, 10 listeners): 0.099
    Signals (3 arguments, 10 listeners): 0.107
    Signals (4 arguments, 10 listeners): 0.185
    Signals (5 arguments, 10 listeners): 0.20600000000000002
    Events (0 argument, 10 listeners): 0.499

  3. T

    Same exact results for me (win64, i5 3.4, chrome)

    Signals (1 argument, 0 listeners): 0.021
    Events (0 argument, 0 listeners): 0.038
    Signals (0 argument, 10 listeners): 0.061
    Signals (1 argument, 10 listeners): 0.064
    Signals (2 arguments, 10 listeners): 0.07100000000000001
    Signals (3 arguments, 10 listeners): 0.077
    Signals (4 arguments, 10 listeners): 0.14
    Signals (5 arguments, 10 listeners): 0.152
    Events (0 argument, 10 listeners): 0.28700000000000003

Leave a Comment

*