question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parallelize ES5 & ES2015 builds

See original GitHub issue

πŸš€ Feature request

Having a possibility to serve ES2015 is awesome! But, the build time was increased nearly twice because now instead of one build we have two.

Please provide ways to deal with this.

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Description

The build time has significantly increased because ES5 and ES2015 builds are sequential.

Is there some reasoning behind this? Would it be faster to run them in parallel (at least with some explicit settings)?

Describe the solution you’d like

  1. Parallelize those builds by default (or with special CLI flag probably)
  2. Add a special CLI flag / configuration in angular.json that allows to build es5 and es2015 separately on different runners. This would be cool for CI because the builds could run on different physical devices (at least for CI tools where the dist folder gets mounted, e.g. Drone CI). This could cause problems with sharing the same dist directory (that is cleared before build), so this needs to be somehow resolved. However, if the option 1 is in place, I guess, this could be omitted

Describe alternatives you’ve considered

Disabling es2015 build 😦

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:30
  • Comments:20 (9 by maintainers)

github_iconTop GitHub Comments

7reactions
clydincommented, Sep 17, 2019

Angular CLI 8.3 and above no longer perform two full builds to support differential loading. Only an ES module compatible build is now created and then down-leveled directly to ES5. This can greatly reduce the time taken to perform a build especially for larger applications.

3reactions
filipesilvacommented, May 29, 2019

There are some concerns about progress reporting but they are minor.

As far as the individual build steps go, they are mostly parallelizable. Almost all compilation steps inside webpack run in the single thread.

There are three very expensive steps that only happen in prod builds: build-optimizer, module concatenation, and minification. Of these, only minification uses parallel processing.

But parallelizing things that themselves try to parallelize does not compose well. At some point the minification steps of both builds would look at the total available CPUs and say β€œright, so let’s use them all”. The best case scenario there is that both just bottleneck and get slower.

That’d be the end of it if CPU was the only relevant shared resource. But there is another one: memory. And that one is less easy to manage. Memory management is Node is mostly static, you define a maximum and there it goes. In Node 12 it figures out the maximum at the start, but that’s still static from there on.

The really bad case is that at some point there are 2 minification processes that are processing a really big chunk (like main) and one/both will hit the memory and crash. To prevent that we’d have to ensure no two builds try to minify at the same time, or that minification doesn’t use parallelism.

But I’m not sure that’d be such a great win insofar as build time. I can’t imagine it would reduce it to half. Parallelization rarely does.

As an aside, we should figure out why the build time in webpack isn’t the full time. It really should be in your first screenshot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Speeding up Angular 10 parallel production build - Ljiljana Matic
At QACube, we have Angular 10 workspace with 6 projects that are built in parallel for production. Over time, our CI/CD pipeline has...
Read more >
Why does Angular build create files with 'es5' and 'es2015' but ...
Angular doesn't bundle the JavaScript files into a single file. You can add a build step to concat the files together. concat-build.js:
Read more >
JavaScript (ES2015+) Enlightenment - Frontend Masters
These compilers are routinely used as part of a build/bundling module process where ... To make all the calls run in parallel, Promise.all()...
Read more >
TypeScript vs ES6 vs ES2015 - Excella
Typescript vs ES6 vs ECMA2015 - decide which is best for your application with our rundown on typings, classes, async and promises for...
Read more >
30. An overview of what's new in ES6 - Exploring JS
The ECMAScript library of built-ins has been expanded to support additional ... 0xFF // ES5: hexadecimal 255 > 0b11 // ES6: binary 3...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found