Thanks for explaining that, Gordon. I guess everybody wonders why the compiler doesn't make use of those opcodes in the the other syntax.

yours
Martin.


On 23/02/2012 03:25, Gordon Smith wrote:
Flash Player has special newarray and newobject bytecodes that are used for 
array literals like [ 1, 2, 3 ] and object literals like { a: 1, b: 2, c: 3 } 
and are faster than a generic constructor call. That's why the coding 
guidelines for Flex recommend using the literal syntax rather than new Array() 
or new Object().

- Gordon Smith, Falcon team, Adobe

-----Original Message-----
From: Roland Zwaga [mailto:rol...@stackandheap.com]
Sent: Wednesday, February 22, 2012 7:29 AM
To: flex-dev@incubator.apache.org
Subject: Re: Flex adopting haXe ?

From: Martin Heidegger [mailto:m...@leichtgewicht.at]
Sent: 22 February 2012 15:18
Also another thing is that

if(a == null) is slower than if(a) .... at least compiled with mxmlc.
Is it really? I didn't know that.

Writing code that enables a cast + comparison to happen quicker than a
direct comparison takes some doing! :/

I'm hoping that Falcon wil emit some more sane opcodes as well.
Actionscript is rife with such weird performance behaviors.

Apparently this:
var array:Array = [];
is faster than:
var array:Array = new Array();

There's plenty more examples like that...



Reply via email to