Over a million developers have joined DZone.

Reducing Compile Time in Eclipse with Parallel Build

· Performance Zone

Evolve your approach to Application Performance Monitoring by adopting five best practices that are outlined and explored in this e-book, brought to you in partnership with BMC.

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

Learn tips and best practices for optimizing your capacity management strategy with the Market Guide for Capacity Management, brought to you in partnership with BMC.

Topics:

Published at DZone with permission of Erich Styger, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}