People often say “Try not to use X function too much it might affect performance”. I always read that Math.abs should be avoided, and that you should just use “(isNegative) ? -value : value”. What functions should I avoid (or use sparingly) to make my stuff more efficient?
What are some expensive functions in AS3 and Flashpunk?
zachwlewis
(Zachary Lewis)
#2
http://jacksondunstan.com/articles/413
If you want speed you should not be using plain functions, local functions, or
Function
variables. This should give some hint as to the speed of Flash’s package-level functions likegetTimer()
. Further, you can get big speedups by foregoing static functions, calls trough an interface, and calls throughsuper
, especially if you’re going to be using that convenience a lot. The rest of the functions are as fast as you can get. Don’t let anyone tell you that access specifiers matter, calling throughthis
adds needless slowdown, functions should befinal
for speed, or overriding is handy but slow. It is handy, but it’s not slow.