Armand Niculescu

Armand is a 32 year old designer and programmer employed with Media Division. He has 15 years experience with programming, specializing in scripting languages such as Actionscript, Javascript and PHP. He also does design and photography.

7 responses to “AS3 Performance Optimization”

  1. Erik

    Very nice article. I really like that you are putting emphasis on the ‘don’t optimize early’ and the ‘do you need to optimize’ parts.

    It would be nice if we had an ActionScript pre compiler who would make these kinds of optimalizations before actualy compiling code. Who knows, someone might feel up to it, hehe.

    Greetz Erik

  2. NoelB

    I haven’t spent much time with flash 10, but it’s amazing to hear that simply typing the elements of an array will grant you similar performance as using vectors in flash 10. Great collection of tips, thanks for the post.

  3. iPhone

    Thanks for the great post..It covers a lots of topics and got to know so much about coding through this..Keep up the good work and i will be looking for some more such posts on your blog.

  4. Blogger Indramayu

    Thanks for share. I need this.

  5. Nick

    Great article. I was wondering if you had any insight into using the array utilities such as array.getIndex() if they are faster then looping through the array and comparing the values? Or maybe you have some tips about combining arrays without entering duplicate values?

    Thanks in advance!

    Armand: .getIndex() is indeed faster than looping. I don’t have benchmark info nearby but it’s difinitely noticeable. However, other methods such as Array.map() or .every() or .some() are rather slow.

  6. Dave

    Thanks for the tips! The one about keeping strongly typed with arrays seems wrong however – I did various tests of this one and I always am getting better performance when I do like: b = myArray[n][i]; instead of the two line method you showed. Here’s a super simple test:

    var b:int;
    var a:Array = new Array([50,50,50],[20,20,20],[30,30,30],[10,10,10]);
    var aa:Array = new Array();

    d = getTimer();
    for(i = 0; i < 5000000; i++){
    b = a[2][2];
    }
    e = getTimer() – d;

    d = getTimer();
    for(i = 0; i < 5000000; i++){
    aa = a[2];
    b = aa[2];
    }
    f = getTimer() – d;
    trace(e,f);

    e is always coming out faster?

Leave a Reply