summaryrefslogtreecommitdiff
path: root/test/bench/timing.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/bench/timing.sh')
-rwxr-xr-xtest/bench/timing.sh42
1 files changed, 24 insertions, 18 deletions
diff --git a/test/bench/timing.sh b/test/bench/timing.sh
index 5cd82dfd9..fec39182c 100755
--- a/test/bench/timing.sh
+++ b/test/bench/timing.sh
@@ -5,11 +5,15 @@
set -e
-GOBIN="${GOBIN:-$HOME/bin}"
-
-. "$GOROOT"/src/Make.$GOARCH
+eval $(gomake --no-print-directory -f ../../src/Make.inc go-env)
PATH=.:$PATH
+havegccgo=false
+if which gccgo >/dev/null 2>&1
+then
+ havegccgo=true
+fi
+
mode=run
case X"$1" in
X-test)
@@ -18,11 +22,11 @@ X-test)
esac
gc() {
- "$GOBIN"/$GC $1.go; "$GOBIN"/$LD $1.$O
+ $GC $1.go; $LD $1.$O
}
gc_B() {
- "$GOBIN"/$GC -B $1.go; "$GOBIN"/$LD $1.$O
+ $GC -B $1.go; $LD $1.$O
}
runonly() {
@@ -32,8 +36,6 @@ runonly() {
fi
}
-
-
run() {
if [ $mode = test ]
then
@@ -59,6 +61,10 @@ run() {
fi
return
fi
+ if ! $havegccgo && echo $1 | grep -q '^gccgo '
+ then
+ return
+ fi
echo -n ' '$1' '
$1
shift
@@ -69,7 +75,7 @@ run() {
fasta() {
runonly echo 'fasta -n 25000000'
run 'gcc -O2 fasta.c' a.out 25000000
- #run 'gccgo -O2 fasta.go' a.out -n 25000000 #commented out until WriteString is in bufio
+ run 'gccgo -O2 fasta.go' a.out -n 25000000 #commented out until WriteString is in bufio
run 'gc fasta' $O.out -n 25000000
run 'gc_B fasta' $O.out -n 25000000
}
@@ -87,7 +93,7 @@ revcomp() {
nbody() {
runonly echo 'nbody -n 50000000'
- run 'gcc -O2 nbody.c' a.out 50000000
+ run 'gcc -O2 -lm nbody.c' a.out 50000000
run 'gccgo -O2 nbody.go' a.out -n 50000000
run 'gc nbody' $O.out -n 50000000
run 'gc_B nbody' $O.out -n 50000000
@@ -117,7 +123,7 @@ regexdna() {
runonly a.out 100000 > x
runonly echo 'regex-dna 100000'
run 'gcc -O2 regex-dna.c -lpcre' a.out <x
-# run 'gccgo -O2 regex-dna.go' a.out <x # pages badly; don't run
+# run 'gccgo -O2 regex-dna.go' a.out <x # restore after regexp.FindIndex is in library
run 'gc regex-dna' $O.out <x
run 'gc regex-dna-parallel' $O.out <x
run 'gc_B regex-dna' $O.out <x
@@ -137,8 +143,8 @@ knucleotide() {
runonly a.out 1000000 > x # should be using 25000000
runonly echo 'k-nucleotide 1000000'
run 'gcc -O2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include k-nucleotide.c -lglib-2.0' a.out <x
- run 'gccgo -O2 k-nucleotide.go' a.out <x # warning: pages badly!
- run 'gccgo -O2 k-nucleotide-parallel.go' a.out <x # warning: pages badly!
+ run 'gccgo -O2 k-nucleotide.go' a.out <x
+ run 'gccgo -O2 k-nucleotide-parallel.go' a.out <x
run 'gc k-nucleotide' $O.out <x
run 'gc k-nucleotide-parallel' $O.out <x
run 'gc_B k-nucleotide' $O.out <x
@@ -154,17 +160,17 @@ mandelbrot() {
}
meteor() {
- runonly echo 'meteor 16000'
- run 'gcc -O2 meteor-contest.c' a.out
- run 'gccgo -O2 meteor-contest.go' a.out
- run 'gc meteor-contest' $O.out
- run 'gc_B meteor-contest' $O.out
+ runonly echo 'meteor 2098'
+ run 'gcc -O2 meteor-contest.c' a.out 2098
+ run 'gccgo -O2 meteor-contest.go' a.out -n 2098
+ run 'gc meteor-contest' $O.out -n 2098
+ run 'gc_B meteor-contest' $O.out -n 2098
}
pidigits() {
runonly echo 'pidigits 10000'
run 'gcc -O2 pidigits.c -lgmp' a.out 10000
-# run 'gccgo -O2 pidigits.go' a.out -n 10000 # uncomment when gccgo library updated
+ run 'gccgo -O2 pidigits.go' a.out -n 10000
run 'gc pidigits' $O.out -n 10000
run 'gc_B pidigits' $O.out -n 10000
}