Reducing Compile Time in Eclipse with Parallel Build

Feeling that building a project in Eclipse (including Kinetis Design Studio) takes a long time? Then probably the ‘parallel build’ option is not enabled in your project: Using parallel build option reduces the needed time by factors. To give an example, to build a project with 56 source files takes 32 seconds without parallel build enabled:

no parallel build

no parallel build

With parallel build enabled this gets reduced down to less than 10 seconds:

Parallel Build Enabled

Parallel Build Enabled

🙂

‘Parallel Builds’ means that the ‘builder’ or make file does not compile one file after each other, but instead spawns a set of parallel builds. This is especially useful for host machines having multiple cores or CPU: such as each CPU then could do a compilation and balance the build load across all available CPUs to cut the build time.

In Eclipse CodeWarrior for MCU the parallel build is enabled by default (see “Using Parallel Builds: what is optimal?“). It is *not* enabled by default in standard Eclipse Kepler GNU ARM Eclipse projects or in the Freescale Kinetis Design Studio. As such, the build time needed for projects are taking a lot of time compared to CodeWarrior.

To speed up the build time, go to the project settings. I can enable ‘Parallel Build’ in the ‘Behaviour’ tab of the C/C++ Build group:

Parallel Build Setting in Behaviour Tab

Parallel Build Setting in Behaviour Tab

The number of ‘optimal jobs’ depends on the number of CPUs of your machine (I have a machine with 8 cores).

The improvement of course depends on the number of cores and speed of your machine. Three to five times improvements are typical on my machine.

There is only one possible drawback of the parallel build: if the project has a lot of compilation errors, the errors are reported ‘in parallel’ too: so if the project has many errors in many files, it is a good idea to turn parallel build off during the error fixing. Apart of that: the parallel build option is great and I have turned it on whenever I can.

Happy Paralleling 🙂

7 thoughts on “Reducing Compile Time in Eclipse with Parallel Build

  1. I can’t wait to try this out.
    However, this option is disabled in my projects. Any ideas on how to re-enable it?

    Like

        • In that case, have you configured it on a workspace level. You should have a link to the workspace settings in that project panel.
          Otherwise: menu Window > Preferences > C/C++ > Build > Settings.
          There you can configure the parallel build settings for all projects in the workspace.
          I hope this helps?

          Like

      • Thanks Erich! You’re right. It’s in the workspace settings. In my case I didn’t notice any improvement. Maybe a second or two at best. I tried 2, 4, & 8 parallel jobs.

        Like

        • that might depend on how ‘parallel’ the compilation can run, e.g .how many files/etc. You should see with 8 parallel builds and 8 cores in the task manager that all cores are utilized (more or less).

          Like

  2. Pingback: RTOS Trace: TraceX with Microsoft Azure RTOS (aka ThreadX) | MCU on Eclipse

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.