Subject: [Linux] why isn't ${TEST} the shell builtin?
To: None <tech-pkg@netbsd.org>
From: Roland Illig <roland.illig@gmx.de>
List: tech-pkg
Date: 06/28/2004 00:10:36
Hi,

pkgsrc seemed to be a little slow to me, and so I had a look what 
happens behind the scenes. I checked which processes are called during a 
"bmake" in shells/bash2. Here are the results:

41392   /usr/bin/test
873     /bin/cat
776     /bin/rm
525     /bin/sed
496     /bin/sh
...

On other operating systems, ${TEST} is defined to be "test" (the shell 
builtin test operator). So I defined this in my /etc/mk.conf and rebuilt 
shells/bash2. These are the results:

873     /bin/cat
776     /bin/rm
525     /bin/sed
496     /bin/sh
432     /usr/bin/gcc
...

They are identical except the thousands of calls to /usr/bin/test. Then 
I did some timing:

roland@wwid:~/proj/pkgsrc/shells/bash2 > time bmake >stdout 2>stderr
real    3m3.799s
user    2m15.440s
sys     0m33.710s

roland@wwid:~/proj/pkgsrc/shells/bash2 > time bmake >stdout 2>stderr
real    5m6.530s
user    2m57.310s
sys     1m48.330s

It's a speed increase of 40% clock time and 70% kernel time. So I wonder 
why ${TEST} is not defined to be the shell builtin in 
$PKGSRC/mk/defs.Linux.mk.

NB: I also tried the shell builtin test on Solaris but failed.

Roland