How to speed up compilation time in linux

compiler-construction, kernel, linux

Solution

I use a non-recursive build system based on GNU make and I was wondering how well it scales.

I ran benchmarks on a 6-core Intel CPU with hyper-threading. I measured compile times using `-j1` to `-j20`. For each `-j` option `make` ran three times and the shortest time was recorded. Using `-j9` results in shortest compile time, 11% better than `-j6`.

In other words, hyper-threading does help a little, and an optimal formula for Intel processors with hyper-threading is `number_of_cores * 1.5`:

Chart data is here.

Problem

While compiling under linux I use flag -j16 as i have 16 cores. I am just wondering if it makes any sense to use sth like -j32. Actually this is a quesiton about scheduling of processor time and if it is possible to put more pressure on particular process than any other this way (let say i have like to pararell compilations each with -j16 and what if one would be -j32?). I think it does not make much sense but I am not sure as do not know how kernel solves such things. Kind regards,

Original source

Related problems