Thu 13 Jul 2017 09:29:18 PM UTC, original submission:
I noticed that some builds are significantly slower after switching from make 4.0 to 4.2.1. I tracked it down to what seems to be a parallel make problem with double-colon prerequisites. In particular, when there are multiple double-colon prereqs for a target, each of those prereqs seems to be considered serially, although their dependencies are built in parallel. It may be easier to explain with an example.
Test makefile:
With GNU make 4.0 the output of 'time make -j' after 'make clean' is:
Note that all 'fileN' recipes begin at the same time, and the dependent 'targetN' recipes begin as soon as their respective prereqs are complete.
The same with GNU make 4.2.1:
Note how the prereqs for target1 are built, then once that's complete the prereqs for target2, and then finally target3. Each set doesn't start until the previous has completed.
I bisected the GNU make repository and found that this is caused by the commit:
[SV 44742] Fix double-colon rules plus parallel builds.
(9bb994e8319c2b153cd3d6d61e2c2882895e7c3a in the git repo).
The 4.2.1 behavior also occurs at the latest commit from source control (e2ebea35f11059e in the git repo).
|