Date: Thu, 24 Jul 2008 00:15:11 +0200 From: Kris Kennaway <kris@FreeBSD.org> To: "V.Chukharev" <chukharev@mail.ru> Cc: dinoex@freebsd.org, "freebsd-ports@freebsd.org" <freebsd-ports@freebsd.org> Subject: Re: Mk/bsd.openssl.mk optimization Message-ID: <4887AD6F.4070704@FreeBSD.org> In-Reply-To: <op.ueqfl1xy0g54sc@localhost> References: <op.ueqfl1xy0g54sc@localhost>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4887AD6F.4070704>