Improve local build speed with parallel build threads
Arc XP Client developers can now toggle parallelization for faster webpack builds using a arc.config.json
file added to the bundle source. This option will speed up the local development builds.
Demo
How to enable
To opt-into this capability, add the following to your arc.config.json
in the root of your bundle folder:
{ "compiler": { "parallel": true, "devtool": "eval" }}
- The
parallel
property toggles the behavior of webpack running in a single node process with an Array of configs versus spawning a pool of Node processes to run the webpack configurations in parallel. If not present, the default value isfalse
, which is the existing behavior. - The
devtool
property enables users to override the default setting ofeval-source-map
toeval
for faster build times at the cost of source maps. If source maps are not important to your web development workflow, setting thedevtool
option toeval
is the recommended choice for development builds with maximum performance. If not present, the default value is the existing behavior.
Benchmarks
We benchmarked this change across a few realistic bundles (using a mix of simple and complex codebases). Here are two examples in total build time numbers (in milliseconds):
Bundle 1 (requires more memory, such as increased JS Heap size limits):
Baseline | With Parallelization Enabled | with devtool=eval | parallelization + devtool=eval | |
---|---|---|---|---|
Run 1 | 52102 | 49252 | 36698 | 34423 |
Run 2 | 50410 | 47588 | 31578 | 34648 |
Run 3 | 51095 | 48276 | 32004 | 35895 |
Average | 51202 | 48372 | 33426 | 34988 |
Change from Baseline | - 6% | - 35% | - 32% |
All benchmarks are in total milliseconds to complete the build.
Bundle2 (complex dependency tree):
Baseline | With Parallelization Enabled | with devtool=eval | parallelization + devtool=eval | |
---|---|---|---|---|
Run 1 | 86023 | 73734 | 59291 | 54119 |
Run 2 | 85590 | 72031 | 60437 | 54900 |
Run 3 | 86274 | 75822 | 60877 | 54997 |
Average | 85962 | 73862 | 60201 | 54672 |
Change from Baseline | - 15% | - 30% | - 37% |
Even though we see consistent around 30% decrease in total build time, itโs hard to quote a general number, because the compilation performance is highly correlated to the dependencies used and the code structure (number of output types, blocks, and the dependency tree for the webpack entrypoints).