Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my ember-cli build time so slow on windows?

Ember-cli is building very slowly with ember server on windows.

Build successful - 13126ms.

Slowest Trees                  | Total
-------------------------------+----------------
TreeMerger (vendor)            | 3154ms
TreeMerger (stylesAndVendor)   | 2051ms
TreeMerger (appAndDependencies) | 1914ms
StaticCompiler                 | 1791ms

This is in contrast to the same project building in less that 1 second on a linux box.

like image 686
Weston Avatar asked Jul 07 '14 13:07

Weston


People also ask

What is an ember CLI build?

Ember CLI, Ember's command line interface, provides a standard project structure, a set of development tools, and an addon system. This allows Ember developers to focus on building apps rather than building the support structures that make them run.

Which command is used to install ember CLI?

Perquisites: You need to have the following dependencies to install Ember CLI: Git. Node. js and NPM.

How does ember build work?

Ember-cli is a toolset to do all that things and ember build runs all needed tasks to build web-application. Some other frameworks may have their own toolset and if you don't use any framework, tools like gulp and webpack exist which are framework-agnostic and help to create your own build process.


3 Answers

There are two big culprits:

  1. Real time file system scanning or protection
    • Realtime-protection from Windows Defender (also know as Microsoft Security Essentials in win7)
    • Windows Search Indexing
    • Antivirus scanning
  2. Unused files in your bower_components folder

Real time Scanning

During a build numerous files are generate in the ./tmp folder of the ember project, both the indexer and the realtime-protection make additional reads of each file which adds a significant amount of additional file I/O operations.

The fix is to:

  • exclude node.exe and/or the ./tmp folder from realtime-protection, and
  • exclude the folder from indexing.
  • Disable real-time antivirus scanning

This should get your build time down to a couple seconds. Additional speed improvements for Windows are being investigated continuing to be investigated in relation to Broccoli's handling of the build process.

Managing unused bower files

Having lots of files in the bower_components is the biggest culprit.

I wrote up a script, clean-ember-cli.js, that deletes everything but ember-cli dependancies, and anything imported in the Brocfile.js. I'm getting back to around 5 second build times.

Update

Reports are that running console as admin also helps.

like image 80
Weston Avatar answered Oct 24 '22 09:10

Weston


Official recommendation from ember-cli to improve its performance on windows

Install ember-cli-windows with node using the below command

npm install -g ember-cli-windows

Run the following command on your project root folder

ember-cli-windows

like image 27
Vinoth Kumar Avatar answered Oct 24 '22 10:10

Vinoth Kumar


mind one important thing... and I didn`t found out in any forum... if you are working with a laptop and you are not connected with AC, windows may run in low performance mode to keep battery. This cause ember build proyects 4 times slower

like image 2
ivanchuk Avatar answered Oct 24 '22 09:10

ivanchuk