Hi!

----

Attached (as "cmd_benchmark_20090730_001.txt") are some preliminary
benchmark results and the script used to create it
("cmdbenchmark.sh.txt", the script still needs some cleanup and
extensions (e.g. cleanup, adding command-line options to modify the test
file size, number of loop iterations, used locale (e.g. "C" vs.
"en_US.UTF-8"), a filter to in-/exclude specific tests, support for
ksh93 builtin commands, removal of hardcoded paths, HTML table output
format)).

Notes:
- /usr/bin/ contains the new versions of the commands build from the
ksh93-integration update2 codebase (the binaries are available from
http://www.opensolaris.org/os/project/ksh93-integration/downloads/2009-07-02/)
- "cksum" appears to be a 3 seconds slower. I think this was the problem
that I logged-in via ssh during that test run
- The test files are on tmpfs and therefore do not require some kind of
"warm-up" to populate the filesystem cache
- The test explictly uses "bash" for the test runs to avoid the
specuation that having ksh93 "preloaded" helps the commands replacements
in any way (since they use the same shared libraries)

Comments/suggestions/etc. welcome...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.ma...@nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 3992797
 (;O/ \/ \O;)
## testing 'typeset -i i ; for (( i=0 ; i < 250 ; i++ )) ; do 
/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/cksum 
</tmp/mytestfile1061 >/dev/null ; done'

real        1:21.72
user        1:05.05
sys           14.07

## testing 'typeset -i i ; for (( i=0 ; i < 250 ; i++ )) ; do /usr/bin/cksum 
</tmp/mytestfile1061 >/dev/null ; done'

real        1:24.61
user        1:12.54
sys           11.03

## testing 'typeset -i i ; for (( i=0 ; i < 200 ; i++ )) ; do 
/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/cmp -l 
/tmp/mytestfile1061 /tmp/mytestfile1061 >/dev/null ; done'

real        3:39.84
user        3:20.05
sys           16.46

## testing 'typeset -i i ; for (( i=0 ; i < 200 ; i++ )) ; do /usr/bin/cmp -l 
/tmp/mytestfile1061 /tmp/mytestfile1061 >/dev/null ; done'

real           1.60
user           0.03
sys            0.12

## testing 'typeset -i i ; for (( i=0 ; i < 100 ; i++ )) ; do 
/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/comm -3 
/tmp/mytestfile1061 /tmp/mytestfile1061 >/dev/null ; done'

real        2:40.51
user        2:31.03
sys            8.71

## testing 'typeset -i i ; for (( i=0 ; i < 100 ; i++ )) ; do /usr/bin/comm -3 
/tmp/mytestfile1061 /tmp/mytestfile1061 >/dev/null ; done'

real          35.72
user          27.02
sys            7.94

## testing 'typeset -i i ; for (( i=0 ; i < 250 ; i++ )) ; do 
/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/cut -f1 -d " " 
</tmp/mytestfile1061 >/dev/null ; done'

real       17:57.70
user       17:42.23
sys           11.98

## testing 'typeset -i i ; for (( i=0 ; i < 250 ; i++ )) ; do /usr/bin/cut -f1 
-d " " </tmp/mytestfile1061 >/dev/null ; done'

real        1:41.31
user        1:27.57
sys           11.04

## testing 'typeset -i i ; for (( i=0 ; i < 500 ; i++ )) ; do 
/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/head -12000 
/tmp/mytestfile1061 /tmp/mytestfile1061 /tmp/mytestfile1061 >/dev/null ; done'

real          42.22
user          25.11
sys           10.98

## testing 'typeset -i i ; for (( i=0 ; i < 500 ; i++ )) ; do /usr/bin/head 
-12000 /tmp/mytestfile1061 /tmp/mytestfile1061 /tmp/mytestfile1061 >/dev/null ; 
done'

real          11.36
user           5.09
sys            0.28

## testing 'typeset -i i ; for (( i=0 ; i < 100 ; i++ )) ; do 
/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/join -o 1.1 2.1 1.2 2.2 
/tmp/mytestfile1061 /tmp/mytestfile1061 >/dev/null ; done'

real       18:52.24
user       10:49.07
sys         8:01.47

## testing 'typeset -i i ; for (( i=0 ; i < 100 ; i++ )) ; do /usr/bin/join -o 
1.1 2.1 1.2 2.2 /tmp/mytestfile1061 /tmp/mytestfile1061 >/dev/null ; done'

real        1:11.39
user          39.02
sys           31.60

## testing 'typeset -i i ; for (( i=0 ; i < 250 ; i++ )) ; do 
/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/paste -d" " 
/tmp/mytestfile1061 >/dev/null ; done'

real       31:22.09
user       31:04.53
sys           13.87

## testing 'typeset -i i ; for (( i=0 ; i < 250 ; i++ )) ; do /usr/bin/paste 
-d" " /tmp/mytestfile1061 >/dev/null ; done'

real          53.45
user          39.82
sys           12.05

## testing 'typeset -i i ; for (( i=0 ; i < 250 ; i++ )) ; do 
/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/tail -500 
</tmp/mytestfile1061 >/dev/null ; done'

real        1:17.18
user          10.05
sys         1:02.86

## testing 'typeset -i i ; for (( i=0 ; i < 250 ; i++ )) ; do /usr/bin/tail 
-500 </tmp/mytestfile1061 >/dev/null ; done'

real           2.91
user           0.03
sys            0.13

## testing 'typeset -i i ; for (( i=0 ; i < 500 ; i++ )) ; do 
/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/tee </tmp/mytestfile1061 
/dev/null /dev/null >/dev/null ; done'

real          57.25
user          10.10
sys           43.94

## testing 'typeset -i i ; for (( i=0 ; i < 500 ; i++ )) ; do /usr/bin/tee 
</tmp/mytestfile1061 /dev/null /dev/null >/dev/null ; done'

real          43.55
user           5.09
sys           35.86

## testing 'typeset -i i ; for (( i=0 ; i < 500 ; i++ )) ; do 
/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/uniq </tmp/mytestfile1061 
>/dev/null ; done'

real        6:32.23
user        6:00.62
sys           25.66

## testing 'typeset -i i ; for (( i=0 ; i < 500 ; i++ )) ; do /usr/bin/uniq 
</tmp/mytestfile1061 >/dev/null ; done'

real        2:20.21
user        1:55.09
sys           22.69

## testing 'typeset -i i ; for (( i=0 ; i < 100 ; i++ )) ; do 
/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/wc -l /tmp/mytestfile1061 
>/dev/null ; done'

real        1:57.36
user        1:52.03
sys            4.38

## testing 'typeset -i i ; for (( i=0 ; i < 100 ; i++ )) ; do 
/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/wc -c /tmp/mytestfile1061 
>/dev/null ; done'

real        1:57.53
user        1:52.03
sys            4.49

## testing 'typeset -i i ; for (( i=0 ; i < 100 ; i++ )) ; do /usr/bin/wc -l 
/tmp/mytestfile1061 >/dev/null ; done'

real          26.33
user          21.02
sys            4.89

## testing 'typeset -i i ; for (( i=0 ; i < 100 ; i++ )) ; do /usr/bin/wc -c 
/tmp/mytestfile1061 >/dev/null ; done'

real           0.92
user           0.01
sys            0.05
#set -o xtrace

# classes for benchmarking
typeset -T benchcmd_t=(
        typeset path
        typeset -a envvars
        typeset benchmark_class
)

typeset -T benchmark_t=(
        integer num_iterations
        typeset cmd
)


# single benchmarks
benchmark_t -a cksum_benchmarks=(
        (
                num_iterations=250
                cmd='%cmd% <%testfile% >/dev/null'
        )
)

benchmark_t -a cmp_benchmarks=(
        (
                num_iterations=200
                cmd='%cmd% -l %testfile% %testfile% >/dev/null'
        )
)

benchmark_t -a comm_benchmarks=(
        (
                num_iterations=100
                cmd='%cmd% -3 %testfile% %testfile% >/dev/null'
        )
)

benchmark_t -a cut_benchmarks=(
        (
                num_iterations=250
                cmd='%cmd% -f1 -d " " <%testfile% >/dev/null'
        )
)

benchmark_t -a head_benchmarks=(
        (
                num_iterations=500
                cmd='%cmd% -12000 %testfile% %testfile% %testfile% >/dev/null'
        )
)

benchmark_t -a join_benchmarks=(
        (
                num_iterations=100
                cmd=$'%cmd% -o 1.1 2.1 1.2 2.2 %testfile% %testfile% >/dev/null'
        )
)

benchmark_t -a paste_benchmarks=(
        (
                num_iterations=250
                cmd='%cmd% -d" " %testfile% >/dev/null'
        )
)

benchmark_t -a tail_benchmarks=(
        (
                num_iterations=250
                cmd='%cmd% -500 <%testfile% >/dev/null'
        )
)

benchmark_t -a tee_benchmarks=(
        (
                num_iterations=500
                cmd='%cmd% <%testfile% /dev/null /dev/null >/dev/null'
        )
)

benchmark_t -a uniq_benchmarks=(
        (
                num_iterations=500
                cmd='%cmd% <%testfile% >/dev/null'
        )
)

benchmark_t -a wc_benchmarks=(
        (
                num_iterations=100
                cmd='%cmd% -l %testfile% >/dev/null'
        )
        (
                num_iterations=100
                cmd='%cmd% -c %testfile% >/dev/null'
        )
)

# the commands we want to test
benchcmd_t -a pastecmds=(
       ( path="/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/cksum"     
benchmark_class="cksum_benchmarks" )
       ( path="/usr/bin/cksum"         benchmark_class="cksum_benchmarks" )

       ( path="/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/cmp"       
benchmark_class="cmp_benchmarks" )
       ( path="/usr/bin/cmp"          benchmark_class="cmp_benchmarks" )

       ( path="/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/comm"      
 benchmark_class="comm_benchmarks" )
       ( path="/usr/bin/comm"         benchmark_class="comm_benchmarks" )

       ( path="/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/cut"       
benchmark_class="cut_benchmarks" )
       ( path="/usr/bin/cut"          benchmark_class="cut_benchmarks" )

       ( path="/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/head"      
benchmark_class="head_benchmarks" )
       ( path="/usr/bin/head"         benchmark_class="head_benchmarks" )

       ( path="/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/join"      
 benchmark_class="join_benchmarks" )
       ( path="/usr/bin/join"         benchmark_class="join_benchmarks" )

       ( path="/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/paste"     
benchmark_class="paste_benchmarks" )
       ( path="/usr/bin/paste"         benchmark_class="paste_benchmarks" )

       ( path="/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/tail"      
benchmark_class="tail_benchmarks" )
       ( path="/usr/bin/tail"         benchmark_class="tail_benchmarks" )

       ( path="/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/tee"       
benchmark_class="tee_benchmarks" )
       ( path="/usr/bin/tee"          benchmark_class="tee_benchmarks" )

       ( path="/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/uniq"      
benchmark_class="uniq_benchmarks" )
       ( path="/usr/bin/uniq"         benchmark_class="uniq_benchmarks" )

       ( path="/home/test001/ksh93/svn/scripts/benchmarks/tmp/oldcmd/wc"        
benchmark_class="wc_benchmarks" )
       ( path="/usr/bin/wc"            benchmark_class="wc_benchmarks" )
)



integer pti # paste_tests index
integer pci

typeset testfilename="/tmp/mytestfile${PID}$$"

# create test input file
rm -f "${testfilename}"
{
        integer i
        for (( i=0 ; i < 20 ; i++ )) ; do
                cat "/usr/pub/UTF-8"
        done
} > "${testfilename}"

for (( pci=0 ; pci < ${#pastecm...@]} ; pci++ )) ; do
        nameref benchmark_class=${pastecmds[pci].benchmark_class}
        
        for (( pti=0 ; pti < ${#benchmark_cla...@]} ; pti++ )) ; do
                nameref tst=benchmark_class[pti]

                testcmd="${tst.cmd}"

                # replace %cmd% and %testfile%
                testcmd="${testcmd/\%cmd\%/${pastecmds[pci].path}}"     
                testcmd="${testcmd//\%testfile\%/${testfilename}}"      

                # build loop
                testcmd="typeset -i i ; for (( i=0 ; i < ${tst.num_iterations} 
; i++ )) ; do ${testcmd} ; done"
                
                # run test
                printf "## testing %q\n" "$testcmd"
                timex bash -c "$testcmd"
        done
done

#timex bash -c 'for (( i=0 ; i < 500 ; i++)) ; do /usr/gnu/bin/paste -d" " 
/usr/pub/UTF-8 >/dev/null ; done'
#timex bash -c 'for (( i=0 ; i < 500 ; i++)) ; do /usr/bin/paste     -d" " 
/usr/pub/UTF-8 >/dev/null ; done'


_______________________________________________
perf-discuss mailing list
perf-discuss@opensolaris.org

Reply via email to