[ALOY-620] Reduce compile time
GitHub Issue | n/a |
---|---|
Type | Story |
Priority | High |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Alloy 1.2.0, Alloy 1.1.0, Alloy 1.0.0 |
Fix Version/s | n/a |
Components | Tooling, XML |
Labels | notable |
Reporter | David Bankier |
Assignee | Feon Sua Xin Miao |
Created | 2013-04-13T12:43:40.000+0000 |
Updated | 2015-06-08T17:39:30.000+0000 |
Description
Here are list of ways or issues that if solved can speed up compile time for quick iterations:
1. Currently all controllers are rebuilt irrespective of whether the view/style/controller has been modified since the last compile.
2. The alloy libraries are also copied to the Resources directory every time unnecessarily (e.g. alloy/underscore.js, alloy/sync/properties.js, etc). I think we should only compile and/or copy when necessary.
3. While I understand the value of uglify js, I'm not sure if it is necessary for quick test iterations.
4. It would be nice to have a compiler flag so that the platform constants, (e.g. OS_IOS) are not uglified out. (This would help support x-platform pushes for TiShadow during development)
I couldn't find the vote button but +1. Time to test is one of my biggest hindrances with Ti. For #3, uglify should happen for release only then debug does without it.
My thoughts so far: 1. definitely 2. definitely 3. uglify-js does a lot more than just minify and obfuscate, as most people use it. We do a number of compile time optimizations by manipulating the AST with it. In addition, some of the functionality of Alloy relies on changes that might relevant to uglify-js. It's not as simple as turning it off. 4. The platform constants you mentioned (OS_IOS for example) don't exist as variables. They are used purely by uglify-js as mentioned in #3. To leave them in is to invite undefined variable errors.
(1) and (2) - great (3) - curious on what else it does and whether it is needed (and can be avoided) during development and testing. Will look at your source code. (4) I realise you pass the constants to uglify, but wouldn't injecting the constant values in the source (i.e. each file) achieve it?
+1 I know Tony is modularizing (is that a word) the Alloy compiler, so I guess that opens the way for either manual or by-deploytype disabling of even more features 'unneeded' during development or using with TiShadow in particular: 1) Disabling cleaning Resources (So that the next one is possible) 2) Disabling checking for and recopying 'BASE RUNTIME FILES' (Alloy + Lib files - don't change that often) 3) Disabling 'builtins' AST module and just copy all builtins 4) Disabling 'optimizer' and 'compress' AST modulse and just inject OS_IOS variables in all files 5) Disabling sourceMapper (of no use to TiShadow) The goal would be to have less optimized code in less time.
On my local Alloy I just added the option to disable sourceMapper. Benchmark went from 3.3 tot 2.9... Pull-request: https://github.com/appcelerator/alloy/pull/139
Another PR that allows you to not selectively but just copy all builtins: https://github.com/appcelerator/alloy/pull/141 PS: Don't really get why the AST modules are called twice, in both
sourceMapper.js
and the compiler'sindex.js
?And final PR for today for not cleaning up: https://github.com/appcelerator/alloy/pull/142
Converting this to an ongoing story with subtasks detailing each possible improvement