Programming

Sunday, March 23, 2008

Speeding up builds

Here's a really simple tip if you are using GNU make. You can pass in the -j option to run the build steps in parallel. The default is -j1, i.e. no parallising.

The next question is what's the optimum number of jobs to run in parallel? An experiment on a build reveals:













NTime
16m13s
23m28s
32m38s
42m11s
51m59s
61m55s
71m53s
81m49s
121m47s
161m47s


So there you have it! On a 4-core CPU (Intel Q6600), it's best with -j4 or above. It's interesting that -j4 didn't max out the CPUs, and that you can keep getting good improvements up to at least -j8.

0 Comments:

Post a Comment

<< Home