Mk/bsd.openssl.mk optimization
Kris Kennaway
kris at FreeBSD.org
Wed Jul 23 22:15:18 UTC 2008
V.Chukharev wrote:
> Dear maintainer,
>
> I have noticed that most time of 'make index' on my system takes a grep for libssl.
> The following is done while 'make index' was running.
>
> $ ps axww | grep libssl
> 23119 p1 IN+ 0:00,00 sh -c grep -l -r "^lib/libssl.so." "/var/db/pkg" | while read contents; do sslprefix=`grep "^@cwd " "${contents}" | /usr/bin/head -n 1`; if test "${sslprefix}" = "@cwd /usr/local" ; then echo "${contents}"; break; fi; done
> 23124 p1 DN+ 0:00,84 grep -l -r ^lib/libssl.so. /var/db/pkg
> 23125 p1 IN+ 0:00,00 sh -c grep -l -r "^lib/libssl.so." "/var/db/pkg" | while read contents; do sslprefix=`grep "^@cwd " "${contents}" | /usr/bin/head -n 1`; if test "${sslprefix}" = "@cwd /usr/local" ; then echo "${contents}"; break; fi; done
> 24555 p1 IN+ 0:00,00 sh -c grep -l -r "^lib/libssl.so." "/var/db/pkg" | while read contents; do sslprefix=`grep "^@cwd " "${contents}" | /usr/bin/head -n 1`; if test "${sslprefix}" = "@cwd /usr/local" ; then echo "${contents}"; break; fi; done
> 24556 p1 DN+ 0:00,41 grep -l -r ^lib/libssl.so. /var/db/pkg
> 24557 p1 IN+ 0:00,00 sh -c grep -l -r "^lib/libssl.so." "/var/db/pkg" | while read contents; do sslprefix=`grep "^@cwd " "${contents}" | /usr/bin/head -n 1`; if test "${sslprefix}" = "@cwd /usr/local" ; then echo "${contents}"; break; fi; done
>
> So I looked through some Mk stuff, and tryed to optimize it. Since I do not
> know any magic of bsd.*.mk, I did just a simple test. And with the below shown
> patch the time is only 1500 s, while with the original version the time is more
> than 15000 s. I guess the time depens very much on number of installed ports,
> I have about 1300.
The right way is either/or:
a) to do the != assignment in bsd.port.subdir.mk and pass it in to the
child make environment. Actually the other != assignments also look
like they should be fixed too, since they'll also be eating up your CPU
time.
b) Try to reduce the number of external commands being invoked by doing
it in shell or make instead (at least partially).
See the recent commits I did to the Mk files for more specifics.
Kris
More information about the freebsd-ports
mailing list