Slow Ember CLI builds and Sass @extends methods
Posted on July 22, 2015 by Ben Limmer

After transitioning back to an older Ember project of mine, I noticed incredibly slow build times compared to other apps I’ve worked on. The initial build was taking almost a full minute, and subsequent builds were taking almost 30 seconds.
Cold Build
Build successful - 51632ms.
Slowest Trees | Total----------------------------------------------+---------------------SassCompiler | 20416msBabel | 7292msBabel | 4652msCoffeeScriptFilter | 2922msES6: App Tree | 2773ms
Slowest Trees (cumulative) | Total (avg)----------------------------------------------+---------------------SassCompiler (1) | 20416msBabel (8) | 12836ms (1604 ms)CoffeeScriptFilter (2) | 4721ms (2360 ms)ES6: App Tree (1) | 2773ms
Subsequent Builds
file changed foo/bar.js
Build successful - 25769ms.
Slowest Trees | Total----------------------------------------------+---------------------SassCompiler | 20473ms
Slowest Trees (cumulative) | Total (avg)----------------------------------------------+---------------------SassCompiler (1) | 20473ms
Removing @extends
This was driving me insane, and I finally tracked down the cause of the slow builds. It was actually our use of Sass @extends. Removing them produced this:
Cold Builds
Build successful - 33243ms.
Slowest Trees | Total----------------------------------------------+---------------------Babel | 7005msBabel | 4645msConcat: Vendor | 3184msCoffeeScriptFilter | 2737msES6: App Tree | 2534msJSHint tests- Mocha | 2330msCoffeeScriptFilter | 1836msJSHint app- Mocha | 1833ms
Slowest Trees (cumulative) | Total (avg)----------------------------------------------+---------------------Babel (12) | 13011ms (1084 ms)CoffeeScriptFilter (2) | 4574ms (2287 ms)Concat: Vendor (1) | 3184msES6: App Tree (1) | 2534msJSHint tests- Mocha (1) | 2330msJSHint app- Mocha (1) | 1833ms
Subsequent Builds
file changed foo/bar.js
Build successful - 6372ms.
Slowest Trees | Total----------------------------------------------+---------------------SassCompiler | 1474msFunnel: App JS Files | 692msES6: App Tree | 617msConcat: App | 603msConcat: Vendor | 438msTreeMerger (appAndDependencies) | 355ms
Slowest Trees (cumulative) | Total (avg)----------------------------------------------+---------------------SassCompiler (1) | 1474msFunnel: App JS Files (1) | 692msES6: App Tree (1) | 617msConcat: App (1) | 603msConcat: Vendor (1) | 438msBabel (12) | 424ms (35 ms)TreeMerger (appAndDependencies) (1) | 355ms
The solution
Turns out that each instance of @extends
was increasing our build time by about 3-4 seconds. So, if your builds are
suddenly really slow, try cutting out your use of @extends
. Some
would say mixins are better, anyway.
At any rate, this has made developing our older app so much more pleasant.