On Wed, 29 Sep 2010 19:10:34 +0200 Josh Hurst wrote:
> Can anyone confirm the benchmarks in
> http://poisonbit.wordpress.com/2010/09/25/choose-a-shell-a-k-a-whatre-u-calling-a-hundred-times/?
> I find it hard to believe that the dash shell outperforms ksh93.

first ask the guy why the timing harness wasn't written in dash

as noted in followups, the posted results compare shell startup times
add one a.out execution and the times converge for all shells

here's a test I just ran on linux.i386-64

--
# cp bash dash ksh .
cat > run <<'!'
set 0 "" 1 "1" 10 "1 2 3 4 5 6 7 8 9 10"
while   :
do      case $# in
        0|1)    break ;;
        esac
        echo
        for sh in *sh
        do      printf '%5s %2d ' $sh $1
                echo $(./ksh -c "time for ((i=0;i<1000;i++));do HISTFILE=/foo 
./$sh ./tst $2; done" 2>&1)
        done
        shift 2
done
echo
!
cat > tst <<'!'
for i
do      id > /dev/null
done
!
chmod +x run tst
./run
--

the ./tst script runs id >/dev/null either 1 or 10 times
and the harness runs the tst script 1000 times
the ./run harness can be run by all the shells

the results

--

 bash  0 real 0m1.07s user 0m0.47s sys 0m0.51s
 dash  0 real 0m0.35s user 0m0.11s sys 0m0.23s
  ksh  0 real 0m0.96s user 0m0.49s sys 0m0.60s

 bash  1 real 0m2.23s user 0m0.86s sys 0m1.07s
 dash  1 real 0m1.41s user 0m0.46s sys 0m0.89s
  ksh  1 real 0m2.07s user 0m0.82s sys 0m1.02s

 bash 10 real 0m12.57s user 0m4.06s sys 0m6.54s
 dash 10 real 0m11.13s user 0m3.16s sys 0m5.40s
  ksh 10 real 0m11.42s user 0m4.90s sys 0m6.51s

--

so if you are running thousands of scripts that do nothing
dash will get it done ~3x faster, but its only 0.3 sec vs 1.0 sec

if the scripts run any a.outs then the features of
the respective shells come into play
e.g., look at what least common denominator does to a simple comparison harness

_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to