Chapter 10. Improving the Performance of make
make plays a critical role in the development
process. It combines the elements of a project to create an
application while allowing the developer to avoid the subtle errors
caused by accidentally omitting steps of the build. However, if
developers avoid using make, because they feel the
makefile is too slow, all the benefits of
make are lost. It is important, therefore, to
ensure that the makefile be crafted to be as
efficient as possible.
Performance issues are
always
tricky, but become even more so when the perception of users and
different paths through the code are considered. Not every target of
a makefile is worth optimizing. Even radical
optimizations might not be worth the effort depending on your
environment. For instance, reducing the time of an operation from 90
minutes to 45 minutes may be immaterial since even the faster time is
a "go get lunch" operation. On the
other hand, reducing a task from 2 minutes to 1 might be received
with cheers if developers are twiddling their thumbs during that
time.
When writing a makefile for efficient execution,
it is important to know the costs of various operations and to know
what operations are being performed. In the following sections, we
will perform some simple benchmarking to quantify these general
comments and present techniques to help identify bottlenecks.
A complementary approach to improving performance is to take
advantage of parallelism and local network topology. By running more
than one command script at a time (even on a uniprocessor), build
times can be reduced.
|