Performance optimizations using object literals
Opened this issue · 3 comments
wilsonsilva commented
Object literals are faster than the new operator
Strings, Numbers (including int and uint), and Boolean objects are usually instantiated using literal notation (var str:String = “text”). Objects and Arrays are often instantiated using the “new” operator – this is seldom necessary (only in the case of a fixed-length Array), and is slower.
var o:Object = {}; is faster than var o:Object = new Object();
and
var a:Array = []; is faster than var a:Array = new Array();
makc commented
you forgot to attach the patch :)
Yaski commented
+1 :)
wilsonsilva commented
I tried to commit the changes but I'm still learning how to use this properly and I'm not sure if everything worked as expected.