Is there any difference (mainly performance) with omiting parentheses when instantiating an object?
var obj1:MyObject = new MyObject();
var obj2:MyObject = new MyObject;
I like the sugar way.
Is there any difference (mainly performance) with omiting parentheses when instantiating an object?
var obj1:MyObject = new MyObject();
var obj2:MyObject = new MyObject;
I like the sugar way.
There is absolutely no difference in the AVM bytecode produced by these two syntaxes.
I used abcdump to look at the ABC code. Below are the results.
AS3
var a1:A = new A;
var a2:A = new A();
ABC
...
5 findpropstrict private::A
7 constructprop private::A (0)
10 coerce private::A
12 setlocal1
13 findpropstrict private::A
15 constructprop private::A (0)
18 coerce private::A
20 setlocal2
...
There should be no difference at all (IMHO). From deduction alone, the 1337 SW engineers hired by adobe would probably have both of those compiled to the same instruction since both lines imply the same thing.