Please note that ExpatTech no longer operates regular office hours, meeting is by appointment only. Please call +36306031104 for details.

ExpatTech Techblog

Peter Todd 2010.02.01. 13:22

Flash Cookbook - Optimisation - Number types used for loops

In this section we will examine the speed of loops with the three number types.

The code is simple:

var a:Number = 0;
var i:int = 0;

for(i = 0; i < 10000000; i++) a = 1;

we just set a number to be 1. Okay, let's run the test above in three cases:

i is an int, uint and Number.

The results:

int 78 ms

uint 94 ms

Number 140 ms

Amazing.