Contrary to popular belief, exceeding the number of available CPU cores
in parallel builds (by running e.g. 'make -j$(($nproc+1))' where 'nproc'
is the number of active CPUs on the system) brings no performance benefit,
and may in fact negatively affect build times. This performance hit can
be further aggravated by the extra memory pressure resulting from the
extraneous jobs.
See:
- https://blog.regehr.org/archives/1416
- http://blog.stuffedcow.net/2011/08/hyperthreading-performance/
This is particularly relevant in two distinct cases:
- on hyper-threaded systems, where half of the active CPUs are separate
threads on the same physical core;
- on virtualized guests systems, where the host physical CPUs are already
affected by system overhead not visible to the guest.
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
def GetNumJobs(props):
if props.hasProperty("slavename") and props.hasProperty("nproc"):
- return ((int(props["nproc"]) / (max_builds[props["slavename"]] + other_builds)) + 1)
+ return (int(props["nproc"]) / (max_builds[props["slavename"]] + other_builds))
else:
return 1