We've had a few customers complain that the dev inner loop for Cordova apps is slow compared to native app development. So recently I've been looking at ways to optimize it. The two largest pieces of a Cordova build are "prepare" and "compile" phases. While there's not much we can realistically do to speed up the native-code compilation (in which gradle/xcodebuild/etc is invoked), it's clear that the prepare phase is not nearly as efficient as it could be. So I opened a JIRA for that, and I have a solution in the works that I want to get feedback on.
CB-11117: Preparing platforms should skip copying files which haven't changed<https://issues.apache.org/jira/browse/CB-11117> Many cordova CLI commands include a "prepare" operation, including 'cordova build', 'cordova run', 'cordova plugin add', and more. Every time each of those commands runs, the target platform is "prepared", which involves copying all files from [<project>/www, <project>/platforms/<platform>/platform_www, <project>/merges/<platform>] to the platform's target www folder, as well as copying a bunch of icons and splash screens to platform-specific locations. For the very first prepare of a platform, all that file copying is necessary. But most of the time after that most of the files being copied have not changed and therefore don't really need to be copied again. So the typical developer inner loop (edit a few source files, build and run the app, repeat) is a lot slower than it could be for a Cordova project, especially one that includes a significant number of source files or resources. Instead, Cordova should be smart enough to skip copying of files that haven't changed, based on their last-modified timestamp. But there should still be a way to force a clean/full/non-incremental copy if desired. To preserve compatibility with all possible existing workflows, I'm leaning toward keeping the full copy as the default behavior, and enabling the optimization only with a new --incremental flag, at least initially. If we find the incremental option is working well for everyone, we can promote that behavior to default in a future major version update. See PRs here for implementation of this idea... https://github.com/apache/cordova-lib/pull/429: Add FileUpdater module to cordova-common https://github.com/apache/cordova-android/pull/295: Use FileUpdater to optimize prepare for android platform I'll submit PRs for cordova-ios and cordova-windows platforms soon, as well as a cordova-cli change to enable the optimization via a new --incremental flag (assuming we don't want to make it the default behavior). Jason
