Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Reducing Compile Time in Eclipse with Parallel Build

DZone's Guide to

Reducing Compile Time in Eclipse with Parallel Build

· Performance Zone ·
Free Resource

Maintain Application Performance with real-time monitoring and instrumentation for any application. Learn More!

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

Collect, analyze, and visualize performance data from mobile to mainframe with AutoPilot APM. Learn More!

Topics:

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}