[FlaconJX] Vector initialization

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[FlaconJX] Vector initialization

Harbs
Currently as code which looks like this.
var myThingy:Vector.<Thingy> = new Vector.<Thingy>(), it is cross compiled in JS to this:

var myThingy = org.apache.flex.utils.Language.Vector();

Considering that this simple returns an empty array, a compiler optimization could be:

var myThingy = [];

Besides being shorter and more efficient to run, it also eliminates a dependency on org.apache.flex.utils.Language.Vector. This dependency just tripped me up in a const (considering that I’m having issues with the order of file loading when initializing constants in classes).

Thoughts?

Harbs
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [FlaconJX] Vector initialization

Alex Harui


On 4/19/17, 3:25 PM, "Harbs" <[hidden email]> wrote:

>Currently as code which looks like this.
>var myThingy:Vector.<Thingy> = new Vector.<Thingy>(), it is cross
>compiled in JS to this:
>
>var myThingy = org.apache.flex.utils.Language.Vector();
>
>Considering that this simple returns an empty array, a compiler
>optimization could be:
>
>var myThingy = [];
>
>Besides being shorter and more efficient to run, it also eliminates a
>dependency on org.apache.flex.utils.Language.Vector. This dependency just
>tripped me up in a const (considering that I’m having issues with the
>order of file loading when initializing constants in classes).
>
>Thoughts?

I don't know if there are other places where the compiler checks a set of
tokens like that, but the code paths it currently goes down don't.  So, we
could try some special case code, I suppose.  FWIW, I think this is one of
the things the BURM is supposed to be good at.

-Alex

Loading...