How to speed up compilation time in linux

前端 未结 3 1125
鱼传尺愫
鱼传尺愫 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 12:55

    The rule of thumb is to use the number of processors+1. Hyper-Thready counts, so a quad core CPU with HT should have -j9

    Setting the value too high is counter-productive, if you do want to speed up compile times consider ccache to cache compiled objects that do not change in each compilation, and distcc to distribute the compilation across several machines.

提交回复
热议问题