You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by lizhi <sl...@qq.com> on 2016/09/23 06:18:36 UTC

how remove numcheck

as code

for (var i:int = 0; i < 100000000;i++ ){
				var a:Number = arr[0]
			}


js code

for (var /** @type {number} */ i = 0; i < 100000000; i++) {
    var /** @type {number} */ a = Number(this.arr[0]);
  }

and how remove the Number(this.arr[0]);

this good,but not good in loop



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-tp55279.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: how remove numcheck

Posted by lizhi <sl...@qq.com>.
it is need too many code,matrix3d.as rawdata 100+as number.and the float32array,and vector no need the check

发自我的iPhone

------------------ Original ------------------
From: Alex Harui [via Apache Flex Development] <ml...@n4.nabble.com>
Date: 周五,9月 23,2016 23:13
To: lizhi <sl...@qq.com>
Subject: Re: how remove numcheck



 

On 9/22/16, 11:56 PM, "lizhi" <[hidden email]> wrote: 

>the float32array also has this issue. 
>and the Number() are slow in loop 

I could be wrong, but I'm pretty sure the compiler should try to insert a 
coercion there, because otherwise the JS code would behave differently 
than the AS code if there were strings in the array. 

The FalconJX compiler allows certain "directives" like 
@flexjsignorecoercion to control coercions since they can be wasteful. 
The following: 

/** 
 * @flexjsignorecoercion Number 
 */ 
        public function numberarr():void 
        { 
  var arr:Array; 
  var n:Number; 
  n = arr[0] as Number; 
                 
        } 

was cross-compiled to: 

/** 
 * @flexjsignorecoercion Number 
 * @export 
 */ 
VectorObject.prototype.numberarr = function() { 
  var /** @type {Array} */ arr; 
  var /** @type {number} */ n; 
  n = arr[0]; 
}; 

Isn't that what you want? 


-Alex 


 
 
 
  If you reply to this email, your message will be added to the discussion below:
 http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-tp55279p55292.html 
  To unsubscribe from how remove numcheck, click here.
 NAML



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-tp55279p55293.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: how remove numcheck

Posted by lizhi <sl...@qq.com>.
or add a new @xxx.

发自我的iPhone

------------------ Original ------------------
From: Alex Harui [via Apache Flex Development] <ml...@n4.nabble.com>
Date: 周五,9月 23,2016 23:13
To: lizhi <sl...@qq.com>
Subject: Re: how remove numcheck



 

On 9/22/16, 11:56 PM, "lizhi" <[hidden email]> wrote: 

>the float32array also has this issue. 
>and the Number() are slow in loop 

I could be wrong, but I'm pretty sure the compiler should try to insert a 
coercion there, because otherwise the JS code would behave differently 
than the AS code if there were strings in the array. 

The FalconJX compiler allows certain "directives" like 
@flexjsignorecoercion to control coercions since they can be wasteful. 
The following: 

/** 
 * @flexjsignorecoercion Number 
 */ 
        public function numberarr():void 
        { 
  var arr:Array; 
  var n:Number; 
  n = arr[0] as Number; 
                 
        } 

was cross-compiled to: 

/** 
 * @flexjsignorecoercion Number 
 * @export 
 */ 
VectorObject.prototype.numberarr = function() { 
  var /** @type {Array} */ arr; 
  var /** @type {number} */ n; 
  n = arr[0]; 
}; 

Isn't that what you want? 


-Alex 


 
 
 
  If you reply to this email, your message will be added to the discussion below:
 http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-tp55279p55292.html 
  To unsubscribe from how remove numcheck, click here.
 NAML



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-tp55279p55295.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: how remove numcheck

Posted by Alex Harui <ah...@adobe.com>.
Please file a bug.  We might be able to use: @implements
{IArrayLike<number>}

-Alex

On 9/25/16, 10:00 PM, "lizhi" <sl...@qq.com> wrote:

>pls add a option.
>it is hard to add all as Number on my code
>
>
>
>--
>View this message in context:
>http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-t
>p55279p55313.html
>Sent from the Apache Flex Development mailing list archive at Nabble.com.


Re: how remove numcheck

Posted by lizhi <sl...@qq.com>.
pls add a option.
it is hard to add all as Number on my code



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-tp55279p55313.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: how remove numcheck

Posted by Alex Harui <ah...@adobe.com>.

On 9/25/16, 7:49 PM, "lizhi" <sl...@qq.com> wrote:

>i have add the -js-output-optimization=skipAsCoercions,and the number()
>are
>there.
>
>and float32array and vector no need the number(float32array[i])
>

It is probably because we don't have a way to specify the type of []
access.

-Alex


Re: how remove numcheck

Posted by lizhi <sl...@qq.com>.
i have add the -js-output-optimization=skipAsCoercions,and the number() are
there.

and float32array and vector no need the number(float32array[i])



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-tp55279p55308.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: how remove numcheck

Posted by lizhi <sl...@qq.com>.
why try check the float32array and vector?it is must number。no need as number

发自我的iPhone

------------------ Original ------------------
From: Alex Harui [via Apache Flex Development] <ml...@n4.nabble.com>
Date: 周五,9月 23,2016 23:44
To: lizhi <sl...@qq.com>
Subject: Re: how remove numcheck



 

On 9/23/16, 8:20 AM, "lizhi" <[hidden email]> wrote: 

>and the js is a simple lang ,no need the same of flashruntime.simple is 
>good 

Many folks have a different opinion.  Their code may be counting on 
implicit type conversions. 

We have provided several options to control output.  Besides 
@flexjsignorecoercion, which should also work at the file level (but there 
might be a bug there), there are new mxmlc options like 
-js-output-optimization=skipAsCoercions which will ignore EVERY "as" 
coercion in your code. 

HTH, 
-Alex 

 
 
 
  If you reply to this email, your message will be added to the discussion below:
 http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-tp55279p55297.html 
  To unsubscribe from how remove numcheck, click here.
 NAML



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-tp55279p55306.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: how remove numcheck

Posted by Alex Harui <ah...@adobe.com>.

On 9/23/16, 8:20 AM, "lizhi" <sl...@qq.com> wrote:

>and the js is a simple lang ,no need the same of flashruntime.simple is
>good

Many folks have a different opinion.  Their code may be counting on
implicit type conversions.

We have provided several options to control output.  Besides
@flexjsignorecoercion, which should also work at the file level (but there
might be a bug there), there are new mxmlc options like
-js-output-optimization=skipAsCoercions which will ignore EVERY "as"
coercion in your code.

HTH,
-Alex


Re: how remove numcheck

Posted by lizhi <sl...@qq.com>.
and the js is a simple lang ,no need the same of flashruntime.simple is good

发自我的iPhone

------------------ Original ------------------
From: Alex Harui [via Apache Flex Development] <ml...@n4.nabble.com>
Date: 周五,9月 23,2016 23:13
To: lizhi <sl...@qq.com>
Subject: Re: how remove numcheck



 

On 9/22/16, 11:56 PM, "lizhi" <[hidden email]> wrote: 

>the float32array also has this issue. 
>and the Number() are slow in loop 

I could be wrong, but I'm pretty sure the compiler should try to insert a 
coercion there, because otherwise the JS code would behave differently 
than the AS code if there were strings in the array. 

The FalconJX compiler allows certain "directives" like 
@flexjsignorecoercion to control coercions since they can be wasteful. 
The following: 

/** 
 * @flexjsignorecoercion Number 
 */ 
        public function numberarr():void 
        { 
  var arr:Array; 
  var n:Number; 
  n = arr[0] as Number; 
                 
        } 

was cross-compiled to: 

/** 
 * @flexjsignorecoercion Number 
 * @export 
 */ 
VectorObject.prototype.numberarr = function() { 
  var /** @type {Array} */ arr; 
  var /** @type {number} */ n; 
  n = arr[0]; 
}; 

Isn't that what you want? 


-Alex 


 
 
 
  If you reply to this email, your message will be added to the discussion below:
 http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-tp55279p55292.html 
  To unsubscribe from how remove numcheck, click here.
 NAML



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-tp55279p55294.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: how remove numcheck

Posted by Alex Harui <ah...@adobe.com>.

On 9/22/16, 11:56 PM, "lizhi" <sl...@qq.com> wrote:

>the float32array also has this issue.
>and the Number() are slow in loop

I could be wrong, but I'm pretty sure the compiler should try to insert a
coercion there, because otherwise the JS code would behave differently
than the AS code if there were strings in the array.

The FalconJX compiler allows certain "directives" like
@flexjsignorecoercion to control coercions since they can be wasteful.
The following:

/**
 * @flexjsignorecoercion Number
 */
	public function numberarr():void
	{
  var arr:Array;
  var n:Number;
  n = arr[0] as Number;
		
	}

was cross-compiled to:

/**
 * @flexjsignorecoercion Number
 * @export
 */
VectorObject.prototype.numberarr = function() {
  var /** @type {Array} */ arr;
  var /** @type {number} */ n;
  n = arr[0];
};

Isn't that what you want?


-Alex



Re: how remove numcheck

Posted by lizhi <sl...@qq.com>.
the float32array also has this issue.
and the Number() are slow in loop



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-tp55279p55287.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: how remove numcheck

Posted by Harbs <ha...@gmail.com>.
Why not make it untyped?

On Sep 23, 2016, at 9:39 AM, lizhi <sl...@qq.com> wrote:

> is it other way?
> 
> this var n:number = arr[i];
> look good
> 
> but the as Number not too good.
> 
> or other option?
> 
> 
> 
> --
> View this message in context: http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-tp55279p55284.html
> Sent from the Apache Flex Development mailing list archive at Nabble.com.


Re: how remove numcheck

Posted by lizhi <sl...@qq.com>.
is it other way?

this var n:number = arr[i];
look good

but the as Number not too good.

or other option?



--
View this message in context: http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-tp55279p55284.html
Sent from the Apache Flex Development mailing list archive at Nabble.com.

Re: how remove numcheck

Posted by Alex Harui <ah...@adobe.com>.
Maybe try:

    var a:Number = arr[0] as Number;

I would add @flexjsignorecoercion Number to an asdoc block for the method.

Another option may be to convert arr to Vector.<Number>

-Alex



On 9/22/16, 11:18 PM, "lizhi" <sl...@qq.com> wrote:

>as code
>
>for (var i:int = 0; i < 100000000;i++ ){
>				var a:Number = arr[0]
>			}
>
>
>js code
>
>for (var /** @type {number} */ i = 0; i < 100000000; i++) {
>    var /** @type {number} */ a = Number(this.arr[0]);
>  }
>
>and how remove the Number(this.arr[0]);
>
>this good,but not good in loop
>
>
>
>--
>View this message in context:
>http://apache-flex-development.2333347.n4.nabble.com/how-remove-numcheck-t
>p55279.html
>Sent from the Apache Flex Development mailing list archive at Nabble.com.