[QUOTE=DesignerMichael;2349248]
Anyone know any good guides to actionscript optimization? I might be getting a little too nitpicky… lol
true vs TRUE
i ++; vs ++i;[/QUOTE]
Those little optimizations tend not to matter too much. The huge one is what sekasi mentioned. Type your variables! This will not only help you debug code but it will make your code MUCH faster. It’s a big performance difference.
Also avoid doing mathematical operations with uint for some reason it’s much slower than a regular int.
[ot]Do you remember that horrible thread where someone spent quite a few posts arguing about whether or not the post- or pre-increment operator was faster as the third statement in a for loop? If not, I don’t recommend trying to find it, but I’ll give you permission to hunt me down (in a giant tractor, perhaps) if I ever become so obsessed with performance that I start arguing with someone over something silly or trivial like that.[/ot]
You probably are… If you really needed the performance increases gained by doing any sort of optimization that is language-specific, then you probably wouldn’t be willing to admit that you were becoming too nitpicky.
Well yes you are being too nit-picky. I’d only suggest worrying that much about optimization if you were doing very low level programming on a function that will be used millions of times on a platform with limited processing power.
Your second one is probably all for naught because you didn’t cast! Cast cast cast! Not just for optimization but for compiler correctness. Proper casting is one of the most effective ways to prevent run-time errors.
Using uint is slower because the processor uses ints natively, so when the instruction needs to be sent to the processor it will be converted anyways. Only use uints for super huge numbers that will never be negative.