usort / csort / t / cmp.sh

#!/usr/bin/zsh -e

echo "TESTING APP: " ${app:="f8"}
APP=$app

i=(10 100 1000 10000 100000 1000000 10000000 100000000 )
t=(10000000 1000000 100000 10000 1000 100 10 3 1 )
sz=${#i[@]}
c=1
echo "Sort Comparison of unsigned integers on N numbers generating according to:"
echo "RANDOM:    random integers"
echo "BOUNDED:   random() % (N/4)"
echo "SORTED:    sorted integers 1...N"
echo "REVERSED:  sorted integers N...1"
echo "IDENT:     all values of the array are \"1\""

echo "\nRANDOM"
echo "N               mysort (secs)   GLIBC (secs)    x-fold speedup"
c=1
while [ $c -lt $sz ] ; do
    ./${APP} ${i[$c]} RAND ${t[$c]}  
    c=$(( $c + 1 ))
done;
exit 0
if [ ! $app = "f4" -a ! $app = "f8" ] ; then
    echo "BOUNDED"
    c=1
    while [ $c -lt $sz ] ; do
        ./${APP} ${i[$c]} BOUNDED ${t[$c]}  
        c=$(( $c + 1 ))
    done;
fi;
echo "SORTED"
c=1
while [ $c -lt $sz ] ; do
    ./${APP} ${i[$c]} SORTED ${t[$c]}  
    c=$(( $c + 1 ))
done;
echo "REVERSED"
c=1
while [ $c -lt $sz ] ; do
    ./${APP} ${i[$c]} REVERSE ${t[$c]}  
    c=$(( $c + 1 ))
done;
echo "IDENT"
c=1
while [ $c -lt $sz ] ; do
    ./${APP} ${i[$c]} IDENT ${t[$c]}  
    c=$(( $c + 1 ))
done;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.