问题
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.
回答1:
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
回答2:
There are two big culprits:
- 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
- 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.
回答3:
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
回答4:
Using ember-cli 1.13.13 with a command prompt running as an administrator fixed it for me
回答5:
In addition to answers provided above run
ember s
in powershell in admin mode. This enables symlinks which are not enabled by default in windows. Having symlinks creates a flatter node_modules folder which results in faster running times.
(Source)
回答6:
With Windows 7 I got a 50% improvement by turning off Encrypting File System (EFS) for the project's /tmp
directory. (right-click Properties->Advanced->Encrypt contents...)
For later versions of Ember CLI running in admin mode as mentioned here and suggested by D-Go in his answer seems to be the way to go, assuming your company allows this.
If like me you are using GIT Bash to run Ember you may be interested in how to set it up to automatically run in admin mode here
来源:https://stackoverflow.com/questions/24612297/why-is-my-ember-cli-build-time-so-slow-on-windows