Az Expattech az ünnepek alatt (dec.24-jan.1.) zárva tart. Nyitás: 2024.január 2

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.