How to speed up ember build?

Hi, we’re having some trouble with an ember build times in our team.

Our main application is composed of the app itself, 9 engines and a few our internal addons. Most of this lives in one repository (we’re using yarn workspaces). We’re on Ember 3.16.

When I run ember build it takes between 5-7 minutes to build. The production build is a bit faster (3-4 mins).

This is the output of tokei

-------------------------------------------------------------------------------
 Language            Files        Lines         Code     Comments       Blanks
-------------------------------------------------------------------------------
 Handlebars           1262        56611        49427          353         6831
 JavaScript           3174       305197       227203        40895        37099
 Sass                   67         4137         3441           52          644
-------------------------------------------------------------------------------
 Total                4503       365945       280071        41300        44574
-------------------------------------------------------------------------------

Before I deep dive into the investigation, are there any tips or what to look for?

Thank you, Ondrej

I’ve used broccoli-viz before to generate a massive visualization of the build and how long each part takes. It can be a little crazy to dig through but can help narrow down what’s taking the longest. The steps in this article seem about right. Not sure about compatibility since you’re on new Ember but hopefully it should work fine.

Anyway, good luck and please post any findings/tips here for posterity!

1 Like

I did some work on this a little bit ago and I tried to break it down in this post: Tips for improving build time of large apps Hopefully it helps!

2 Likes

@ondrejsevcik I’m not yet sure what the answer is because I’ve just started thinking about optimizing the builds but to compare our project seems to be 3 times smaller:

===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 CSS                   464        21119        17912          241         2966
 Handlebars            696        29758        27923          377         1458
 HTML                    1           26           21            0            5
 JavaScript            965        53709        43904         2133         7672
 Sass                   46         2737         2392            7          338
===============================================================================
 Total                2172       107349        92152         2758        12439
===============================================================================

and it takes ~ 1.5 min to build and ~10 sec to rebuild on my machine which already drives me crazy :wink:

1 Like

@tniezurawski these perf docs might help, worth a read ember-cli/perf-guide.md at c9320aeb9fb521887bd8fec8f722bef0608c9fe5 · ember-cli/ember-cli · GitHub

1 Like