You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ha...@apache.org on 2019/11/28 16:50:10 UTC

[royale-asjs] branch develop updated: string literals are not set in the constructor

This is an automated email from the ASF dual-hosted git repository.

harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 265c230  string literals are not set in the constructor
265c230 is described below

commit 265c230ac5d555b2643bb9220bb5b69408abd66d
Author: Harbs <ha...@in-tools.com>
AuthorDate: Thu Nov 28 18:49:50 2019 +0200

    string literals are not set in the constructor
    
    The string literal will work because the comparison is not strict
---
 frameworks/projects/XML/src/main/royale/XML.as | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/frameworks/projects/XML/src/main/royale/XML.as b/frameworks/projects/XML/src/main/royale/XML.as
index 8bdc99e..2ecd067 100644
--- a/frameworks/projects/XML/src/main/royale/XML.as
+++ b/frameworks/projects/XML/src/main/royale/XML.as
@@ -906,7 +906,7 @@ package
 				if (lastChild && lastChild._nodeKind == ELEMENT) {
 					
 					const wrapper:XML = new XML();
-					wrapper._nodeKind = ELEMENT;
+					// wrapper._nodeKind = ELEMENT;
 					child = new XML(child.toString());
 					wrapper.setName(lastChild.name());
 					child.setParent(wrapper);
@@ -1169,7 +1169,7 @@ package
 			*/
 			var i:int;
 			var xml:XML = new XML();
-			xml._nodeKind = _nodeKind;
+			xml.setNodeKind(_nodeKind);
 			xml.setName(name());
 			xml.setValue(_value);
 			var len:int;
@@ -1872,7 +1872,7 @@ package
 			return declaredNS;
 		}
 		
-		private var _nodeKind:String = ELEMENT;
+		private var _nodeKind:String = "element";
 		/**
 		 * Specifies the type of node: text, comment, processing-instruction, attribute, or element.
 		 * @return


Re: [royale-asjs] branch develop updated: string literals are not set in the constructor

Posted by Greg Dove <gr...@gmail.com>.
Harbs, I never did verify that the original change to use string references
instead of literals saved memory - it should have (in theory), but I think
you were going to check. Did it make a difference? Certainly if it does
not, you should remove it (I think it was a single commit isolated from
other changes)



On Fri, Nov 29, 2019 at 6:07 AM Harbs <ha...@gmail.com> wrote:

> The older code works, but this code uses less memory.
>
> Greg added an optimization to use String class instances instead of
> literals. That optimization undid an older optimization of not writing the
> default nodeKinds.
>
> Reverting to default literals on the prototype saved a couple of MB of
> memory in my app.
>
> > On Nov 28, 2019, at 7:00 PM, Alex Harui <ah...@adobe.com.INVALID>
> wrote:
> >
> > Is this a temporary workaround? Shouldn't the old code work?
> >
> > Get Outlook for Android<https://aka.ms/ghei36>
> >
> > ________________________________
> > From: harbs@apache.org <ha...@apache.org>
> > Sent: Thursday, November 28, 2019 8:50:10 AM
> > To: commits@royale.apache.org <co...@royale.apache.org>
> > Subject: [royale-asjs] branch develop updated: string literals are not
> set in the constructor
> >
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > harbs pushed a commit to branch develop
> > in repository
> https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-asjs.git&amp;data=02%7C01%7Caharui%40adobe.com%7C5e9143c74afb4b2e0cd308d7742308d4%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637105566130549447&amp;sdata=gvTjl3kQ2I04ghkuwarZ7VBaGLXXdWMbA74WFfptQik%3D&amp;reserved=0
> >
> >
> > The following commit(s) were added to refs/heads/develop by this push:
> >     new 265c230  string literals are not set in the constructor
> > 265c230 is described below
> >
> > commit 265c230ac5d555b2643bb9220bb5b69408abd66d
> > Author: Harbs <ha...@in-tools.com>
> > AuthorDate: Thu Nov 28 18:49:50 2019 +0200
> >
> >    string literals are not set in the constructor
> >
> >    The string literal will work because the comparison is not strict
> > ---
> > frameworks/projects/XML/src/main/royale/XML.as | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/frameworks/projects/XML/src/main/royale/XML.as
> b/frameworks/projects/XML/src/main/royale/XML.as
> > index 8bdc99e..2ecd067 100644
> > --- a/frameworks/projects/XML/src/main/royale/XML.as
> > +++ b/frameworks/projects/XML/src/main/royale/XML.as
> > @@ -906,7 +906,7 @@ package
> >                                 if (lastChild && lastChild._nodeKind ==
> ELEMENT) {
> >
> >                                         const wrapper:XML = new XML();
> > -                                       wrapper._nodeKind = ELEMENT;
> > +                                       // wrapper._nodeKind = ELEMENT;
> >                                         child = new
> XML(child.toString());
> >
>  wrapper.setName(lastChild.name());
> >                                         child.setParent(wrapper);
> > @@ -1169,7 +1169,7 @@ package
> >                         */
> >                         var i:int;
> >                         var xml:XML = new XML();
> > -                       xml._nodeKind = _nodeKind;
> > +                       xml.setNodeKind(_nodeKind);
> >                         xml.setName(name());
> >                         xml.setValue(_value);
> >                         var len:int;
> > @@ -1872,7 +1872,7 @@ package
> >                         return declaredNS;
> >                 }
> >
> > -               private var _nodeKind:String = ELEMENT;
> > +               private var _nodeKind:String = "element";
> >                 /**
> >                  * Specifies the type of node: text, comment,
> processing-instruction, attribute, or element.
> >                  * @return
> >
>
>

Re: [royale-asjs] branch develop updated: string literals are not set in the constructor

Posted by Harbs <ha...@gmail.com>.
The older code works, but this code uses less memory.

Greg added an optimization to use String class instances instead of literals. That optimization undid an older optimization of not writing the default nodeKinds.

Reverting to default literals on the prototype saved a couple of MB of memory in my app.

> On Nov 28, 2019, at 7:00 PM, Alex Harui <ah...@adobe.com.INVALID> wrote:
> 
> Is this a temporary workaround? Shouldn't the old code work?
> 
> Get Outlook for Android<https://aka.ms/ghei36>
> 
> ________________________________
> From: harbs@apache.org <ha...@apache.org>
> Sent: Thursday, November 28, 2019 8:50:10 AM
> To: commits@royale.apache.org <co...@royale.apache.org>
> Subject: [royale-asjs] branch develop updated: string literals are not set in the constructor
> 
> This is an automated email from the ASF dual-hosted git repository.
> 
> harbs pushed a commit to branch develop
> in repository https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-asjs.git&amp;data=02%7C01%7Caharui%40adobe.com%7C5e9143c74afb4b2e0cd308d7742308d4%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637105566130549447&amp;sdata=gvTjl3kQ2I04ghkuwarZ7VBaGLXXdWMbA74WFfptQik%3D&amp;reserved=0
> 
> 
> The following commit(s) were added to refs/heads/develop by this push:
>     new 265c230  string literals are not set in the constructor
> 265c230 is described below
> 
> commit 265c230ac5d555b2643bb9220bb5b69408abd66d
> Author: Harbs <ha...@in-tools.com>
> AuthorDate: Thu Nov 28 18:49:50 2019 +0200
> 
>    string literals are not set in the constructor
> 
>    The string literal will work because the comparison is not strict
> ---
> frameworks/projects/XML/src/main/royale/XML.as | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/frameworks/projects/XML/src/main/royale/XML.as b/frameworks/projects/XML/src/main/royale/XML.as
> index 8bdc99e..2ecd067 100644
> --- a/frameworks/projects/XML/src/main/royale/XML.as
> +++ b/frameworks/projects/XML/src/main/royale/XML.as
> @@ -906,7 +906,7 @@ package
>                                 if (lastChild && lastChild._nodeKind == ELEMENT) {
> 
>                                         const wrapper:XML = new XML();
> -                                       wrapper._nodeKind = ELEMENT;
> +                                       // wrapper._nodeKind = ELEMENT;
>                                         child = new XML(child.toString());
>                                         wrapper.setName(lastChild.name());
>                                         child.setParent(wrapper);
> @@ -1169,7 +1169,7 @@ package
>                         */
>                         var i:int;
>                         var xml:XML = new XML();
> -                       xml._nodeKind = _nodeKind;
> +                       xml.setNodeKind(_nodeKind);
>                         xml.setName(name());
>                         xml.setValue(_value);
>                         var len:int;
> @@ -1872,7 +1872,7 @@ package
>                         return declaredNS;
>                 }
> 
> -               private var _nodeKind:String = ELEMENT;
> +               private var _nodeKind:String = "element";
>                 /**
>                  * Specifies the type of node: text, comment, processing-instruction, attribute, or element.
>                  * @return
> 


Re: [royale-asjs] branch develop updated: string literals are not set in the constructor

Posted by Alex Harui <ah...@adobe.com.INVALID>.
Is this a temporary workaround? Shouldn't the old code work?

Get Outlook for Android<https://aka.ms/ghei36>

________________________________
From: harbs@apache.org <ha...@apache.org>
Sent: Thursday, November 28, 2019 8:50:10 AM
To: commits@royale.apache.org <co...@royale.apache.org>
Subject: [royale-asjs] branch develop updated: string literals are not set in the constructor

This is an automated email from the ASF dual-hosted git repository.

harbs pushed a commit to branch develop
in repository https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitbox.apache.org%2Frepos%2Fasf%2Froyale-asjs.git&amp;data=02%7C01%7Caharui%40adobe.com%7C5e9143c74afb4b2e0cd308d7742308d4%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C637105566130549447&amp;sdata=gvTjl3kQ2I04ghkuwarZ7VBaGLXXdWMbA74WFfptQik%3D&amp;reserved=0


The following commit(s) were added to refs/heads/develop by this push:
     new 265c230  string literals are not set in the constructor
265c230 is described below

commit 265c230ac5d555b2643bb9220bb5b69408abd66d
Author: Harbs <ha...@in-tools.com>
AuthorDate: Thu Nov 28 18:49:50 2019 +0200

    string literals are not set in the constructor

    The string literal will work because the comparison is not strict
---
 frameworks/projects/XML/src/main/royale/XML.as | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/frameworks/projects/XML/src/main/royale/XML.as b/frameworks/projects/XML/src/main/royale/XML.as
index 8bdc99e..2ecd067 100644
--- a/frameworks/projects/XML/src/main/royale/XML.as
+++ b/frameworks/projects/XML/src/main/royale/XML.as
@@ -906,7 +906,7 @@ package
                                 if (lastChild && lastChild._nodeKind == ELEMENT) {

                                         const wrapper:XML = new XML();
-                                       wrapper._nodeKind = ELEMENT;
+                                       // wrapper._nodeKind = ELEMENT;
                                         child = new XML(child.toString());
                                         wrapper.setName(lastChild.name());
                                         child.setParent(wrapper);
@@ -1169,7 +1169,7 @@ package
                         */
                         var i:int;
                         var xml:XML = new XML();
-                       xml._nodeKind = _nodeKind;
+                       xml.setNodeKind(_nodeKind);
                         xml.setName(name());
                         xml.setValue(_value);
                         var len:int;
@@ -1872,7 +1872,7 @@ package
                         return declaredNS;
                 }

-               private var _nodeKind:String = ELEMENT;
+               private var _nodeKind:String = "element";
                 /**
                  * Specifies the type of node: text, comment, processing-instruction, attribute, or element.
                  * @return