A little note about optimisation

Now, I’m most definitely not the best person to ask about optimisation… I like things nice and jumbles where I want them whilst I’m working. Of course, when I’m done, and the thing lags like crazy I’ve hit a snag. So I asked the guys over at http://www.triquitips.com for some advice, and they certainly obliged!

Before any of these techniques, my test ran like this.

Noddybear mentions bitmap caching, something I’ve not really run into before, but some internet research found what it means. Basically, it will take a movie clip, keep running the vector data but draw a bitmap instead, supposedly making things much faster. Unfortunately, the bitmap needs to be redrawn everytime something other than movement happens to the movie clip, and it isn’t therefore extremely relevant here. I can cache the replacement mouse, and the duplicated circles without much trouble, but anything past that moves far too much to make it worthwhile.

Prograhamming told me to move to AS3. I will. Soon…

Then Souled helped me out with a few code optimisation techniques:

Instead of using this-

  1. mc.onEnterFrame=function(){

I should use this-

  1. function onEnterFrame(){
  2. with (mc){

This not only considerably sped up my test, but also forced me to structure the code in a much more readable manner, which can only be good!

Then, when defining variables, I should always define the type of variable too-

  1. blah=0;

Should be-

  1. var blah:Number = 0;

Doing this to all my variables also sped up the test considerably!

And after applying these techniques and restructuring the actionscript the test runs like this.

So thanks to you guys!

Make sure you check out their sites-
Noddybear
Prograhamming
Souled

-->

One Response to “A little note about optimisation”

  1. souled Says:

    heh… no problem. :D

Leave a Reply