It looks like GCC provides more than one way to deal with renaming. Right now the compiler does prevent renaming of public things, but we have not measured how expensive that is. In the future, it might be possible to determine which public things are being access with [] syntax and only prevent renaming on those things.
But Josh ran into some issues with 3rd-party JS libraries and we went the conservative route, although I did not realize it blew up the FlexJS examples into the 400K range. So I will try to make optimization level a compiler option so folks can choose. -Alex On 10/20/15, 11:54 PM, "Harbs" <harbs.li...@gmail.com> wrote: >I have no idea how things are working in the compiler, but here are my >thoughts: > >1) The vast majority of the code is internal to FlexJS. Even if client >code does not lose names, the library itself should be minified as much >as possible. As a reference, the Angular library is over 700 KB, but >less than 100 KB minified. >2) Angular has a way of preventing losing names on dependencies using the >archaic array notation.[1] The notation is really un-intuitive, but >works. I’m hoping we can do better. Maybe we can use a new ActionScript >metadata tag? >3) It seems to me that there should be a way to prevent variables marked >public from getting minified away. Isn’t there notation that Google >Compiler reads to prevent renaming? > >[1]https://scotch.io/tutorials/declaring-angularjs-modules-for-minificatio >n > >On Oct 21, 2015, at 3:08 AM, Josh Tynjala <joshtynj...@gmail.com> wrote: > >> As long as FlexJS apps don't use external libraries, it should be safe >>to >> do more drastic optimization like automatically renaming variables and >> things. This must be disabled for code transpiled with asjsc because >> external JS libraries can be referenced in the transpiled code, and >>those >> names must remain unchanged. It's possible to pass in externs files to >>the >> closure compiler, but that presents a high barrier to entry. >> >> I could not find a way to turn off the advanced optimizations for asjsc >> apps without also turning it off in FlexJS apps. As I recall, it gets >> configured in the middle of a big method, so it wasn't easy for me to >> override something. Some refactoring could make that more easily >> configurable across different JS output types. >> >> On the other hand, changing the names of variables and things is >>considered >> a bad practice by many developers because there's a risk of breaking >> things. If I had to guess, other types of optimizations (like enabling >>gzip >> on your server) would give you a similar file size reduction. >> >> - Josh >> >> On Tue, Oct 20, 2015 at 4:36 PM, Alex Harui <aha...@adobe.com> wrote: >> >>> Josh turned off the variable renaming. I suppose we should turn it on >>>for >>> flexjs apps. >>> >>> >>> Sent from my LG G3, an AT&T 4G LTE smartphone >>> >>> >>> ------ Original message------ >>> >>> From: Harbs >>> >>> Date: Tue, Oct 20, 2015 3:51 PM >>> >>> To: dev@flex.apache.org; >>> >>> Subject:Re: [DISCUSS] Release Apache FlexJS 0.5.0 >>> >>> >>> Yes. They do. Pretty exciting! >>> >>> Question: >>> >>> The release js for the data binding example is 432 KB. Why is it so >>>big? >>> >>> On Oct 21, 2015, at 1:25 AM, Alex Harui <aha...@adobe.com> wrote: >>> >>>> Yay! So in the examples folder, should be some examples in >>>>bin/js-debug >>>> and bin-debug folders. They should run and work mostly. >>>> >>>> Thanks for sticking with it. >>>> -Alex >>>> >>>> On 10/20/15, 3:17 PM, "Harbs" <harbs.li...@gmail.com> wrote: >>>> >>>>> OK. I feel like I just took a big step in the right direction! :-) >>>>> >>>>> approve: >>>>> >>>>> +1 >>>>> Package >>>>> >>> >>>http://apacheflexbuild.cloudapp.net:8080/job/flex-asjs/lastSuccessfulBui >>>ld >>>>> /artifact/out/apache-flex-flexjs-0.5.0-src.tar.gz >>>>> Java 1.7 >>>>> OS: Mac OS X x86_64 10.9.5 >>>>> Source kit signatures match: y >>>>> Source kit builds: y >>>>> README is ok: y >>>>> RELEASE_NOTES is ok: y >>>>> NOTICE is ok: y >>>>> LICENSE is ok: y >>>>> No unapproved licenses or archives: y >>>>> No unapproved binaries: y >>>>> >>>>> >>>>> main: >>>>> >>>>> BUILD SUCCESSFUL >>>>> Total time: 9 minutes 12 seconds >>>>> >>>>> (There’s still parts of this process that’s a bit fuzzy to me, but >>> things >>>>> are definitely getting clearer.) >>>>> >>>>> On Oct 14, 2015, at 10:09 AM, Alex Harui <aha...@adobe.com> wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> Similar to the FalconJX discuss thread, I spent some time today >>>>>>trying >>>>>> to >>>>>> make the FlexJS release testing simpler. And like for FalconJX, it >>>>>> would >>>>>> be great for folks to try it and report issues. >>>>>> >>>>>> You still need to set up the pre-requisites manually (Ant, Java, >>>>>>AIR, >>>>>> Flash playerglobal, Flash Player Debugger), but ‘ant all’ should now >>> run >>>>>> without needing flex-sdk or flex-asjs or any other repo. Of >>>>>>course, my >>>>>> system isn’t quite as ‘clean’ as some of yours so I may have missed >>>>>> something. >>>>>> >>>>>> For FlexJS, I opted to update the ApproveFlexJS script so that pull >>>>>>a >>>>>> binary release of FalconJX and FlexUnit so you don’t need to set up >>>>>>any >>>>>> additional environment variables. Note, though, that I did not put >>>>>>the >>>>>> logic to pull those binary releases into the main build scripts >>> because, >>>>>> at least for me as a developer, I don’t want to be working against >>>>>> binary >>>>>> artifacts, I want to be working against the various repos. >>>>>> >>>>>> So, to try out my latest attempt at simplification, you must use the >>>>>> ApproveFlexJS script which you can get from [1]. See the steps >>>>>>below: >>>>>> >>>>>> 0) Make sure Ant and Java are in the path, and set up AIR_HOME, >>>>>> PLAYERGLOBAL_HOME and FLASHPLAYER_DEBUGGER environment variables if >>>>>>you >>>>>> haven’t already. Then: >>>>>> 1) create an empty folder. >>>>>> 2) Copy ApproveFlexJS.xml from the flex-asjs repo or download it >>>>>>here >>>>>> [1] and copy it into the empty folder >>>>>> 3) From the empty folder, run ‘ant -e -f ApproveFlexJS.xml >>>>>> -Drelease.version=0.5.0’ >>>>>> >>>>>> It will take you through examining the notice files and then at the >>> end, >>>>>> it should download FalconJX and FlexUnit, then build FlexJS and run >>>>>>its >>>>>> tests unattended. >>>>>> >>>>>> If you want to grab the bits manually, they are here [2]. >>>>>> >>>>>> Thanks in advance for trying it. >>>>>> -Alex >>>>>> >>>>>> [1] >>>>>> >>>>>> >>> >>>https://git-wip-us.apache.org/repos/asf/flex-sdk/repo?p=flex-asjs.git;a= >>>b >>>>>> lo >>>>>> b_plain;f=ApproveFlexJS.xml;hb=refs/heads/develop >>>>>> [2] >>>>>> >>>>>> >>> >>>http://apacheflexbuild.cloudapp.net:8080/job/flex-asjs/lastSuccessfulBui >>>l >>>>>> d/ >>>>>> artifact/out/ >>>>>> >>>>>> >>>>> >>>> >>> >>> >