Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1685] Improve incremental build times

GitHub Issuen/a
TypeImprovement
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterJan Vennemann
AssigneeJan Vennemann
Created2019-05-02T14:25:23.000+0000
Updated2020-05-05T11:32:52.000+0000

Description

The "alloy compile" command is executed on every incremental build, even if no files change. This takes a huge amount of our total build time on incremental builds. Implementing proper incremental build support to only process changed files would be a huge performance gain.

Comments

  1. Hans Knöchel 2020-05-05

    This is an absolute must have for Alloy to compete with modern app frameworks. We currently spend around 10-15s for each Alloy compile (only the compile, everything else comes on top) - even if no file changed. Alloy should have a simple file watcher that keeps hashes of every file and only compile them if the hash changed. There is even an [open pull request](https://github.com/appcelerator/alloy/pull/927) for this from one year ago but it seems to have been abandoned since then.
  2. David Bankier 2020-05-05

    This can be implemented really easily with code that has been around since the early days of alloy. TiShadow has been using it for a long time to do fast updates. Basically just use a file watcher and then you can selectively compile alloy files. For example:
       alloy compile -b --platform=ios --config sourcemap=false,file=app/controllers/index.js
       
    (Personally I use tishadow for all development, but you could create an independant alloy watcher module that would do this very easily.)
  3. Jan Vennemann 2020-05-05

    The reason that this is not integrated in the CLI build is that we can't fully rely on the usual NodeJS file watchers like chokidar, since a user can CTRL-C out of the build and then no changes would be tracked anymore. Before the user kicks off a new CLI build he may have edited a couple of other files that we are now unaware of so we would have to do a full Alloy build again. I tried to address this in https://github.com/appcelerator/alloy/pull/927 but unfortunately i never had the time to finish that. It only watches controllers/views, all other unnecessary processing Alloy does in incremental builds like copying a whole lot of unchanged files around is still happening. The same applies when using the existing file restriction flag to selectively compile controllers/views. In the meantime we started working on Webpack support, which will address almost all Alloy incremental build issues. It uses an approach similar to TiShadow, in that it will start a server in the background that keeps running Webpack in watch mode, which will make sure to compile changed files in between CLI builds. The new [alloy-loader](https://github.com/appcelerator/alloy-loader) processes changed controllers/views/styles. Webpack makes sure to only process changed files from other folders as well (like app/lib or app/vendor). You can expect to see more of this new build pipeline in the next two weeks.
  4. David Bankier 2020-05-05

    Great! Thanks.

JSON Source