Testing environment

You will find many tables that covers execution time. All this are done on machine:

Comp1
Intel(R) Core(TM) Duo CPU E8400 @ 3000Hz 3.00 GHz, 3 .00 GB of RAM with Windows XP Professional SP3, Flash player version 9.0.115.0, NOT DEBUG PLAYER

All the tests were not done using the debug player and they were not running in debug mode which is very important in specific cases. Each test case was running ten times. The result shown is always the average execution time of the ten runs. This way two tests do not conflict with the garbage collection and each test is just responsible for its own memory usage. Before each run there is a ten seconds delay in order to not conflict with the Flash player starting procedure.

From result that using uint and int in loop did not make time difference. But I suggest you use where you can int instead of uint. You can find interesting article about (int vs uint vs Number) this topics here:

Avoid ints in ActionScript, by Sho Kuwamoto, date: June 15th, 2006
Types in AS3: ints not so fast, uints slow!, by Grant Skinner, date: June 15th, 2006
Use the Correct Type for the Job, by Think, date: June 20th, 2006
Optimization: When to do it., by Keith Peters, date: June 21st, 2006

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package {
   
    import flash.display.Sprite;
    import flash.text.TextField;
    import flash.utils.getTimer;
    import flash.utils.setTimeout;
    import flash.system.Capabilities;
   
    [SWF(frameRate = '255')]
   
    public class TestCase extends Sprite {
        private static const n: int = 10000000;
       
       
        public function TestCase() {
            setTimeout(runTest, 10000);
        }
       
        private function runTest(): void {
            var a: Number = 0;
            for ( var i: int = 0; i < 10; ++i ) a += test06();
            a /= 10;
            showResults(a);
        }
       
        private function showResults(result_:Number):void {
            var result_txt:TextField = new TextField();
            result_txt.x = result_txt.y = 10;
            result_txt.width = 300;
            result_txt.text = "Iterations: [10^" + (String(n).length - 1) + "], int[ms]: " + result_ +"\nisDebugger: " + Capabilities.isDebugger + "\nversion: " + Capabilities.version;
            addChild(result_txt);
        }
       
       
        // 1. Iterations: [10^5], int[ms]: 4.7
        // 2. Iterations: [10^5], int[ms]: 5
        // 3. Iterations: [10^5], int[ms]: 4.4
        // 4. Iterations: [10^5], int[ms]: 4.7
        private function test00(): int {
            var startTime:int = getTimer();
           
            //test start
            for (var i:int = 0; i < n; ++i ) {
                var a: Number = ( 1 as Number );
            }
           
            //test end
            return (getTimer() - startTime);
        }
       
        // 1. Iterations: [10^5], int[ms]: 5.4
        // 2. Iterations: [10^5], int[ms]: 5.2
        // 3. Iterations: [10^5], int[ms]: 5.2
        // 4. Iterations: [10^5], int[ms]: 5.4
        private function test01(): int {
            var startTime:int = getTimer();
           
            //test start
            for (var i:uint = 0; i < n; ++i ) {
                var a: Number = ( 1 as Number );
            }
           
            //test end
            return (getTimer() - startTime);
        }
       
        // 1. Iterations: [10^7], int[ms]: 32.9
        // 2. Iterations: [10^7], int[ms]: 33.1
        // 3. Iterations: [10^7], int[ms]: 32.9
        // 4. Iterations: [10^7], int[ms]: 33.4
        private function test03(): int {
            var startTime:int = getTimer();
           
            //test start
            var k:uint;
            for (var i:int = 0; i < n; ++i ) {
                k++;
            }
           
            //test end
            return (getTimer() - startTime);
        }
       
       
        // 1. Iterations: [10^7], int[ms]: 33
        // 2. Iterations: [10^7], int[ms]: 32.8
        // 3. Iterations: [10^7], int[ms]: 33
        // 4. Iterations: [10^7], int[ms]: 32.8
        private function test04(): int {
            var startTime:int = getTimer();
           
            //test start
            var k:int;
            for (var i:int = 0; i < n; ++i ) {
                k++;
            }
           
            //test end
            return (getTimer() - startTime);
        }
       
       
        // 1. Iterations: [10^7], int[ms]: 91.8
        // 2. Iterations: [10^7], int[ms]: 91.8
        // 3. Iterations: [10^7], int[ms]: 91.7
        // 4. Iterations: [10^7], int[ms]: 91.8
        private function test05(): int {
            var startTime:int = getTimer();
           
            //test start
            var k:int;
            for (var i:int = 0; i < n; ++i ) {
                k = (i + 15) / 7;
            }
           
            //test end
            return (getTimer() - startTime);
        }
       
        // 1. Iterations: [10^7], int[ms]: 91.8
        // 2. Iterations: [10^7], int[ms]: 92.3
        // 3. Iterations: [10^7], int[ms]: 92.2
        // 4. Iterations: [10^7], int[ms]: 92.2
        private function test06(): int {
            var startTime:int = getTimer();
           
            //test start
            var k:uint;
            for (var i:int = 0; i < n; ++i ) {
                k = (i + 15) / 7;
            }
           
            //test end
            return (getTimer() - startTime);
        }
    }
}
Creative Commons License
This work, unless otherwise expressly stated, is licensed under a Creative Commons Attribution 2.5 Bulgaria License.