Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 May 2007 20:34:29 +1000
From:      Peter Jeremy <peterjeremy@optushome.com.au>
To:        Stephen Montgomery-Smith <stephen@math.missouri.edu>, ports@freebsd.org, hackers@freebsd.org
Subject:   Re: Looking for speed increases in "make index" and pkg_version for ports
Message-ID:  <20070529103429.GD70055@turion.vk2pj.dyndns.org>
In-Reply-To: <20070527223048.GA37505@icarus.home.lan>
References:  <4659EF80.70100@math.missouri.edu> <20070527223048.GA37505@icarus.home.lan>

next in thread | previous in thread | raw e-mail | index | archive | help

--MnLPg7ZWsaic7Fhd
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On 2007-May-27 15:30:48 -0700, Jeremy Chadwick <koitsu@freebsd.org> wrote:
>This sounds like a good solution.  In fact, I'm lead to believe that
>heavy reliance on /bin/sh is part of why the ports collection is slow.

Someone needs to enable accounting on a recent -current (with the
high-resolution accounting records) and look at where the time is
actually going.  (My -current box needs upgrading before I could
do this).

That said, /bin/sh is dynamically linked and a fork/exec is not cheap.
Some quick-and-not-necessarily-reliable tests on 6.2-STABLE/amd64 show
that /bin/sh takes about 2.5 times as long to start as /rescue/sh
(though it's only 2:1 on i386).  (These are different boxes so the
absolute times aren't comparable).

amd64% time sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); echo fo=
o; done' >/dev/null
sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); echo foo; done' >  =
 0.20s user 0.08s system 98% cpu 0.283 total
amd64% time sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); echo fo=
o; done' >/dev/null=20
sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); echo foo; done' >  =
 0.22s user 0.06s system 97% cpu 0.287 total
amd64% time sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); echo fo=
o; done' >/dev/null
sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); echo foo; done' >  =
 0.19s user 0.10s system 98% cpu 0.288 total
amd64% time sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); /rescue=
/sh -c "echo foo"; done' >/dev/null
sh -c  > /dev/null  0.84s user 6.12s system 97% cpu 7.162 total
amd64% time sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); /rescue=
/sh -c "echo foo"; done' >/dev/null
sh -c  > /dev/null  1.12s user 6.05s system 97% cpu 7.366 total
amd64% time sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); /bin/sh=
 -c "echo foo"; done' >/dev/null
sh -c  > /dev/null  5.72s user 13.40s system 96% cpu 19.734 total
amd64% time sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); /bin/sh=
 -c "echo foo"; done' >/dev/null=20
sh -c  > /dev/null  5.97s user 12.89s system 97% cpu 19.407 total
amd64%  =20

i386% time sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); echo foo=
; done' >/dev/null
sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); echo foo; done' >  =
 0.17s user 0.03s system 95% cpu 0.208 total
i386% time sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); echo foo=
; done' >/dev/null
sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); echo foo; done' >  =
 0.17s user 0.03s system 99% cpu 0.199 total
i386% time sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); echo foo=
; done' >/dev/null
sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); echo foo; done' >  =
 0.16s user 0.04s system 99% cpu 0.200 total
i386% time sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); /rescue/=
sh -c "echo foo"; done' >/dev/null
sh -c  > /dev/null  3.68s user 18.19s system 98% cpu 22.212 total
i386% time sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); /rescue/=
sh -c "echo foo"; done' >/dev/null
sh -c  > /dev/null  3.34s user 18.54s system 98% cpu 22.110 total
i386% time sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); /bin/sh =
-c "echo foo"; done' >/dev/null=20
sh -c  > /dev/null  12.03s user 29.42s system 98% cpu 41.965 total
i386% time sh -c 'i=3D0; while [ $i -lt 10000 ]; do i=3D$(($i+1)); /bin/sh =
-c "echo foo"; done' >/dev/null
sh -c  > /dev/null  12.20s user 29.25s system 98% cpu 41.975 total

--=20
Peter Jeremy

--MnLPg7ZWsaic7Fhd
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQFGXAG1/opHv/APuIcRAks8AKCdrEBJKOJKodeq4N+IAMNh4AKvrwCfQdGP
CxG8wrZlvsAwy/UGKRfiuzc=
=lNGY
-----END PGP SIGNATURE-----

--MnLPg7ZWsaic7Fhd--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070529103429.GD70055>