Home > ActionScript 3, PureLegs, PureMVC, RobetLegs > AS3 framework option #3

AS3 framework option #3

January 24th, 2012 Leave a comment Go to comments

After analyzing 2 most popular framework both from syntax and performance point of view – I realized that both frameworks is not good enough for me. I work mainly with games and heavy applications that requires both code writing speed and code execution speed. With that knowledge I did what any programmer usually does in such situation – started my own project! where everything will be perfect! it will be fast! it will be comfortable to work with! and sun will shine all day long!

So I started with writing requirements…

AS3 framework requirements

Primary goal : framework must run fast! (and by fast I mean fastest possible…)
Secondary goal : framework must be simple! (and by that I mean dead simple…)
ah yes.. and it have to actually implement MVC architecture too…

MVC is very simple. There is only 2 main things it actually does:

  • it lets you brake you application in parts and get those parts  easily.
  • it lets those parts to communicate.

and it does it in a way that almost completely removes hassle of creating architecture for your big and complicated application and leave you with fun part. It standardize your code for team work and for reuse.


Framework will implement MVC in this way:

set up your application run Commands Get models Get mediators Send messages Listen for messages



So what I did was – I took the parts from PureMVC and RobotLegs that I loved… I discarded everything that I didn’t liked:

  • Kept RobotLegs like dependency injection.
  • Used PureMVC notification system like messaging without ANY need to convert any types.
  • Avoid any of bad practices that are technically possible in PureMVC(getting mediators) and in RobotLegs(listen events from model).
  • Kept API dead simple and intuitive.
  • Kept modular programming dead simple.

In the end I come up with this solution – project code-name PureLegs !!

You can find it in GitHub :  PureLegs-framework


I would ask you to have a look at it! I need you help, try to use it! tell me what you would like to see better… and most of all – what you don’t like about it.


PureMVC is faster then RobotLegs in almost all cases, and PureLegs is faster then PureMVC in almost all cases! (and the single case there it is not – it’s equal)

Table with data for actions per 1ms.

RobetLegs runs/1ms PureMVC runs/1ms PureLegs runs/1ms
Time to run 1 command:
Command with nothing: 144.9 513.3 1385.0
Command with parameter: 100.4 511.0 1344.1
Command with Model: 94.2 480.3 889.7
Command with Model and View call: 77.0 258.3 545.3
Time to register 1 mediator:
>> max 1000 mediators: 21.3 50.0 47.6
>>> max 2000 mediators: 21.5 48.8 51.3
>>> max 5000 mediators: 22.7 49.0 49.0
Time to remove 1 mediator:
>>> max 1000 mediators: 90.9 17.9 83.3
>>> max 2000 mediators: 50.0 10.2 62.5
>>> max 5000 mediators: 27.8 4.4 29.9
Communication with many mediators:
Message to 1 receiving mediators: 994.0 1902.9 3096.0
Message to 100 receiving mediators: 33.6 16.4 206.6
>>> time for 1 communication: 3364.7 1636.4 20661.2
Message to 200 receiving mediators: 16.8 8.3 100.8
>>> time for 1 communication: 3364.7 1653.4 20161.3
Message to 500 receiving mediators: 6.7 3.4 40.9
>>> time for 1 communication: 3349.0 1676.3 20470.8
Message to 1000 receiving mediators: 3.4 1.7 21.2
>>> time for 1 communication: 3414.1 1692.2 21216.4


Another table with how PureLegs many times is faster:

PureMVC RobotLegs
Running commands 2.11 7.08
Registering mediators 1.00 2.16
Removing mediators 6.16 1.08
Sending messages to 1 listener 1.63 3.11
Sending messages to many listeners 12.19 6.14


PureLegs test:

Run PureLegs tests        [Source code: PureLegsSpeedTest.zip]

Previous tests:

Run RobetLegs tests        [Source code: RobotLegsSpeedTest.zip]

Run PureMVC tests           [Source code: PureMVCSpeedTest.zip]


Stay tuned.

  1. January 25th, 2012 at 13:37 | #1

    Awesome stuff! I don’t have time to look through it right now, but I always appreciate it when people write code to solve their problems instead of simply complaining about other solutions. Nicely done.

  2. January 26th, 2012 at 14:54 | #2


    I am planing to make small YouTube video with short presentation of what and why this solution does.
    I will drop you a link then it’s ready.

  3. stica
    January 31st, 2012 at 11:26 | #3

    nice one ray

  4. February 11th, 2012 at 14:55 | #4

    @shaun I do agree, but I am the one who complained a lot at first place because reality forcing us sometimes, then founded time between my contracts using commonly used MVC’s and written my own as well :)

    I will definitely take a look at this solution. But feel free to investigate mine.

  5. February 12th, 2012 at 11:26 | #5


    Thanks for the link! I will definitively have a look at it.

    Maybe we should peer review each other solutions? and try to learn from each other?!

  6. March 4th, 2012 at 00:34 | #6

    Only one week left and I’ll be back to this subject soon. I have to say I had a green light for use my solution in commercial product. That was the biggest lesson for me, when time of production and performance was crucial. I improved my framework a lot and got few ideas to improve it even further. If I can suggest something to you. Get yourself some target for some dummy project and keep going with your framework, it’s the best thing to test its abilities and stuff in real life production. Trial by fire :)

    Wonder if we could set up some challenge task and both independently try to solve it using our frameworks? Then compare results and share with each other? After that, switch frameworks over and have another go?

  1. February 12th, 2012 at 00:29 | #1