It is a good practice to use int in place of Number if the type int can able to satisfy your requirements. First we will see the difference between int,uint and Number.
- uint - values ranging from 0 to 4,294,967,29 (positive numbers)
- int - values ranging from -2,147,483,648 to 2,147,483,647
- Number -can have values ranging far beyond int and uint and can include a decimal point
Among above three int type is faster follwed by Number. In looping always use int in place of Number.
Avoid:
Use:
var l:int = myArray.length;
for(var i:Number=0; i<l;i++>
{
............
}
var l:int = myArray.length;
for(var i:int=0; i<l;i++>
{
............
}
share on: facebook


3 comments:
Prove it. Do a benchmark on this and post the results.
While I agree that if you have millions of loops you might gain a second or so, I seriously doubt that the change you have made here will have any impact on the speed of the application at all.
If it isn't measurable, it doesn't matter.
Genial fill someone in on and this fill someone in on helped me alot in my college assignement. Thanks you as your information.
I always inspired by you, your thoughts and way of thinking, again, appreciate for this nice post.
- Norman
Post a Comment