Posts Tagged performance

Should You Bother Giving Variables a Type?

Many modern strongly-typed languages have introduced a way for you to not have to type a variable’s type. In C#, you can use var instead of the actual type. In C++, you use auto. AS3 has a similar feature with it’s “untyped” type: *. In those other languages, var and auto are syntax sugar that the compiler replaces with the actual type. Will the AS3 compiler and/or Flash Player do the same for us? Today’s article finds out if it’s safe to skip the type and just use *.

Read the rest of this entry »

Tags: , , ,

7 Comments

describeType vs. describeTypeJSON

flash.utils.describeType has been around since Flash 9 and is the standard way to find out interesting information about a Class type, including its metadata/annotations. However, there’s a hidden function called describeTypeJSON that provides an interesting alternative. Since describeType is notoriously slow, could describeTypeJSON be the speedy alternative we’ve been looking for? Today’s article puts them to the test!

Read the rest of this entry »

Tags: , , , , , ,

7 Comments

The Right Way to Check An Object’s Type

There are lots of ways to check the type of an object in AS3. These include the is operator, the deprecated instanceof operator, the constructor field, and a combination of getQualifiedClassName and getDefinitionByName. Which is fastest, cleanest, and most effective? Today’s article puts them all to the test to find out!

Read the rest of this entry »

Tags: , , , , ,

4 Comments

The Cost of If-Else

The if-else keyword is not free. So, how expensive is it? Today’s article finds out.

Read the rest of this entry »

Tags: , ,

6 Comments

Bytecode Analysis: Why do-while Is so Slow

The do-while loop is slower than the for and while loops… at least in Flash. Why? Today’s article digs into the bytecode the compiler generates for a variety of these loops to find out why.

Read the rest of this entry »

Tags: , , , ,

10 Comments

ByteArray Secrets

The ByteArray class is not as straightforward as you might think. In certain situations, it has surprising, undocumented functionality. Today’s article goes into some of these strange behaviors so you’ll get a better handle on exactly what’s going on behind the scenes.

Read the rest of this entry »

Tags: , , , ,

6 Comments

Optimize Algorithms and Data Structures First

Today’s article is both a reminder to optimize your algorithms and data structures before your code and a demonstration of the payoff you’ll get by doing so. By choosing the most effective algorithm and data structure to solve your problem you’ll reap huge rewards in performance. A 10x, 100x, or even bigger boost is easily attainable.

Read the rest of this entry »

Tags: , , , ,

No Comments

Recursion vs. Iteration

Function calls in Flash are notoriously slow. Recursive algorithms require lots of function calls by definition. So are iterative versions faster? Today’s article explores whether or not it’s worth converting your recursive algorithm into an iterative one.

Read the rest of this entry »

Tags: , , ,

10 Comments

Int Keys: Object vs. Dictionary vs. Array vs. Vector

Given that Object and Dictionary can have int keys and that int keys are faster than String keys, a natural performance test follows: which class is fastest at reading from and writing to those int keys? Is there a difference between the four Vector classes? Today’s article performs just that test and comes up with the answers.

Read the rest of this entry »

Tags: , , , , , , , ,

8 Comments