Does an exhibit hit when creating an array on an orange attributes?
Example objects:
var x: object = {one: 1, two: 2, three: 3}; For (var s: string in x) {trace (x [s]); }
vs. using an array
var a: array = [1, 2, 3]; Var LeMen: Numbers = A. Long; (Var i: number = 0; i & lt; len; ++ i) {trace (a [i]); }
So - which factor is the fastest and most important thing?
IIRC, in some javascript implementations, objects running on objects again are slow to 20x, but I'm not able to find such a measurement for Action Script 2.
I just tried a lot of testing, but just once more than 200k elements resulted in more contrast: Task Build-AR: 2221mm Task IARR: ARI: 516 MS Task Build-OBG: 1410 MS Tasks ITR-OBJ: 953 MS
I Doubt That Luke's trial has a loop overhead, which looks bigger in the array case. Also, note that the array has taken a long time to populate the first place, so if your work is heavy, then ymmv.
In addition, in my testing, arching arr.length in the local variable has a measurable growth rate of around 15%.
Update:
By popular demand, I am posting the code used.
var iter: number = 200000; Var Time: Number = 0; Var obj: object = {}; Var arr: array = []; Time = getTimer (); (Var i: number = 0; i
Comments
Post a Comment