GNU make: should the number of jobs equal the number of CPU cores in a system?

后端 未结 10 1052
长情又很酷
长情又很酷 2020-12-07 10:13

There seems to be some controversy on whether the number of jobs in GNU make is supposed to be equal to the number of cores, or if you can optimize the build time by adding

10条回答
  •  轮回少年
    2020-12-07 11:03

    I, personally, use make -j n where n is "number of cores" + 1.

    I can't, however, give a scientific explanation: I've seen a lot of people using the same settings and they gave me pretty good results so far.

    Anyway, you have to be careful because some make-chains simply aren't compatible with the --jobs option, and can lead to unexpected results. If you're experiencing strange dependency errors, just try to make without --jobs.

提交回复
热议问题