Recursive make speedup patch

Oliver Eikemeier eikemeier at fillmore-labs.com
Sun Jan 25 16:22:36 PST 2004


Kris Kennaway wrote:

> The patch available at
> 
>   http://people.freebsd.org/~kris/recursive-speedup.patch
> 
> gives a 43% speedup for 'make index' in my testing:
> 
> No optimization
> 1899.40 real       648.67 user      1148.96 sys
> 
> Optimized version
> 1096.76 real       504.48 user       565.90 sys
> 
> The optimizations I used were:
> 
> * Don't unconditionally include <bsd.gnome.mk> twice for every port;
> only do so if the port defines USE_GNOME or WANT_GNOME.  I had to
> modify a couple of ports to make this work, and I'm not 100% certain
> there are no unintended side-effects.
> 
> * Pass down some more variables from bsd.port.subdir.mk instead of
> assigning them by forking a shell to evaluate a command in each child
> makefile.
> 
> * Don't invoke perl just to print a string in 'make describe'
> 
> * Use make transformation magic instead of invoking 'basename' in a
> shell.
> 
> There are some more things that could be looked at, but they're more
> difficult and the benefits are unknown:
> 
> * A lot of the variable assignments in bsd.port.mk (e.g. CONFIGURE
> stuff) are not necessary for recursive targets like 'make describe'.
> They could be hidden behind a conditional and avoided unless we're
> actually doing a port build.  I'm not sure how expensive these are
> though, so it may not be worth it.

How about the following:

Create a bsd.ports.mk.cache that caches all variables that are unlikely
to change (like PORTOBJFORMAT) saving at least some spawned processes?



More information about the freebsd-ports mailing list