How to speed up compilation time in linux

前端 未结 3 1135
鱼传尺愫
鱼传尺愫 2021-01-07 12:19

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

3条回答
  •  鱼传尺愫
    2021-01-07 13:01

    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:

    enter image description here

    Chart data is here.

提交回复
热议问题