Given the mention of 'sort' in another thread, I would like to mention something that I have thought about for some time. When one does parallel builds on systems with many cores (particularly slow cores), the time to complete a build is improved if build products which take a long time are done first and ones which complete quickly are done last. Most importantly, a really slow compilation/link should not be scheduled last if at all possible. The reason for this is that all other objects may have already been compiled while one or two last objects which are slow to compile or link are still completing. Linking may be I/O bound and take a long time while leaving plenty of CPU for other compilations.

The thought is that if the time to build each component is captured and saved, then subsequent builds can be done in inverse order of build times (by listing them in that order), subject to build dependencies. This could even be codified in the makefiles in the distribution tarball.

The benefits would be greatest for non-recursive builds where all of the targets may be scheduled at once (modified by explicit dependencies) by one make process.

The maximum possible benefit would be determined by the slowest build product (if it had been scheduled to start last).

Thoughts?

Bob
--
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

Reply via email to