# Improve local build speed with parallel build threads

Source: https://dev.arcxp.com/pagebuilder-engine/how-to-guides/optimization-and-deployment/improve-local-build-speed-with-parallel-build-threads/

> **Note:**
> 
> This feature was introduced in Engine 4.1.8 and 5.0.4 releases that brings additional compiler options using a new `arc.config.json` configuration file. See [arc.config.json documentation](https://dev.arcxp.com/pagebuilder-engine/developer-docs/arcconfigjson) to learn more about other compiler options.

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

[ Play ](https://youtube.com/watch?v=KtANSfp9UCE) 

## How to enable

To opt-into this capability, add the following to your `arc.config.json` in the root of your bundle folder:

```json
{
  "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 is `false`, which is the existing behavior.
- The `devtool` property enables users to override the default setting of `eval-source-map` to `eval` for faster build times at the cost of source maps. If source maps are not important to your web development workflow, setting the `devtool` option to `eval` 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):_**

![Bundle 1](https://dev.arcxp.com/src/content/docs/pagebuilder-engine/images/bundle-1.jpg)

|                      | 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):_**

![Bundle 2](https://dev.arcxp.com/src/content/docs/pagebuilder-engine/images/bundle-2.jpg)

|                      | 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%                         |

> **Note:**
> 
> All benchmarks are in total milliseconds to complete the build.

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).
