Ember Build Performance With Different Environments
This article was last edited over 3 years ago. Information here may no longer be accurate. Please proceed with caution, and feel free to contact me.
I have found that building Ember on Linux (with and without Docker) and Mac (without Docker) are fairly fast and all reasonably close in speed.
Each of those environments built in less than 15 seconds for me.
The major performance outlier was Docker for Mac. With Docker for Mac, builds took 1 minute and 16 seconds. The performance issues using Docker for Mac are well documented.
I want to specifically call out the official Docker documentation that shows this is not an Ember issue, but rather, a macOS and Docker issue that effects multiple frameworks and tools. Docker has a lengthy article on these issues.
There are a number of issues with the performance of directories bind-mounted with osxfs … Applications that behave in this way include:
- rake
- ember build
- Symfony
- Magento
- Zend Framework
- PHP applications that use Composer to install dependencies in a vendor folder
I have found that
docker-sync
was the simplest and most performant solution to this
issue. Build times came in at 20 seconds, which is
obviously fantastic compared to “normal”
Docker for Mac speeds. I had tried a number of other workarounds
beforehand. rsync scripts, Samba, NFS, but nothing worked quite as
well as docker-sync
.
See test data and information here.
Linux
Could not start watchman
Visit https://ember-cli.com/user-guide/#watchman for more info.
cleaning up...
Built project successfully. Stored in "dist/".
real 0m14.923s
user 0m14.732s
sys 0m0.800s
Mac
cleaning up...
Built project successfully. Stored in "dist/".
real 0m8.543s
user 0m6.825s
sys 0m2.156s
Docker (Linux Host)
Could not start watchman
Visit https://ember-cli.com/user-guide/#watchman for more info.
cleaning up...
Built project successfully. Stored in "dist/".
real 0m14.633s
user 0m14.752s
sys 0m0.921s
Docker (Mac Host)
Could not start watchman
Visit https://ember-cli.com/user-guide/#watchman for more info.
cleaning up...
Built project successfully. Stored in "dist/".
real 1m16.261s
user 0m19.710s
sys 0m5.730s
Docker (Mac Host with docker-sync)
Could not start watchman
Visit https://ember-cli.com/user-guide/#watchman for more info.
cleaning up...
Built project successfully. Stored in "dist/".
real 0m20.308s
user 0m17.530s
sys 0m2.040s
How I Tested
I would like to stress that these tests were not very scientific, and were subject to a number of environmental issues (what else was I running on my machine at the time? Was my hard drive or CPU being stressed?).
My goal was not to show the most accurate performance characteristics, but rather, to show how performance (relatively) varies between different builds environments. I hope this will successfully detail how dramatically performance can change between these different scenarios.
Linux and macOS
Wipe out the current $HOME/.nvm
install.
rm -rf ~/.nvm/
Reinstall NVM.
Install latest lts version of node. Verify the system is using it.
nvm install --lts && which node
Install ember-cli
with npm.
npm install -g ember-cli
Clone super-rentals.
git clone https://github.com/ember-learn/super-rentals
Change to the super-rentals
directory.
cd super-rentals
Use yarn to install node modules.
yarn install
Time a build.
time ember build
Docker on Linux and macOS
Clone super-rentals.
git clone https://github.com/ember-learn/super-rentals
Run a docker container for node lts (at time or
writing, node:8.9.1
) with
super-rentals
mounted inside.
Install ember-cli
with npm.
npm install -g ember-cli
Change to the super-rentals
directory.
cd /super-rentals
Use yarn to install node modules.
yarn install
Time a build.
time ember build