]> Cypherpunks repositories - gostls13.git/commitdiff
time tests; sort -nr times.out | sed 10q is illuminating.
authorRuss Cox <rsc@golang.org>
Fri, 9 Oct 2009 18:18:32 +0000 (11:18 -0700)
committerRuss Cox <rsc@golang.org>
Fri, 9 Oct 2009 18:18:32 +0000 (11:18 -0700)
cut the slowest tests  down from a few seconds
to under half a second.

R=r
DELTA=21  (6 added, 1 deleted, 14 changed)
OCL=35509
CL=35519

test/gc1.go
test/ken/divconst.go
test/ken/modconst.go
test/mallocrand.go
test/mallocrep.go
test/mallocrep1.go
test/map.go
test/peano.go
test/run

index eecc036fc7c883ad521ed72857268a36b6f57d4d..055079aabe5a3d46f1a53ce3fd4130a8e3a4bf19 100644 (file)
@@ -7,7 +7,7 @@
 package main
 
 func main() {
-       for i := 0; i < 1000000; i++ {
+       for i := 0; i < 1e5; i++ {
                x := new([100]byte);
                _ = x;
        }
index 29f1b067c94f7691cc2713f7f9894b9644aea316..0b2e059748fad23478554d732d024ff2d82dc3bc 100644 (file)
@@ -8,7 +8,7 @@ package main
 
 import "rand"
 
-const  Count   = 1e6
+const  Count   = 1e5
 
 func
 i64rand() int64
index 7c35edeaa9cd0d4089eebe43136fc7097ff05771..2419a4cf5e39f15675229001ea2792bd05e73f9e 100644 (file)
@@ -8,7 +8,7 @@ package main
 
 import "rand"
 
-const  Count   = 1e6
+const  Count   = 1e5
 
 func
 i64rand() int64
index 59da01d44c531bd2f114aa3317511b0e2f545d15..c0184699ff58fd362672802d30c311d0f5705a2e 100644 (file)
@@ -56,7 +56,7 @@ func main() {
        flag.Parse();
 //     prime();
        var blocks [1] struct { base *byte; siz uintptr; };
-       for i := 0; i < 1<<12; i++ {
+       for i := 0; i < 1<<10; i++ {
                if i%(1<<10) == 0 && *chatty {
                        println(i);
                }
index 6306e59ebc00b351854b71391378d5d18759eb32..5367787e9abfdadcdaf2d0396f3eafe9bf5d9f7e 100644 (file)
@@ -31,7 +31,7 @@ func bigger() {
 func main() {
        flag.Parse();
        malloc.GetStats().Alloc = 0;    // ignore stacks
-       for i := 0; i < 1<<8; i++ {
+       for i := 0; i < 1<<7; i++ {
                for j := 1; j <= 1<<22; j<<=1 {
                        if i == 0 && *chatty {
                                println("First alloc:", j);
index 2f9900d940e5caed881d2fecbe358847bcd10d40..7552e99b469e1f89621f1b6148b82a168e3b614c 100644 (file)
@@ -98,11 +98,15 @@ func main() {
                AllocAndFree(atoi(flag.Arg(0)), atoi(flag.Arg(1)));
                return;
        }
-       for j := 1; j <= 1<<22; j<<=1 {
+       maxb := 1<<22;
+       if !*longtest {
+               maxb = 1<<19;
+       }
+       for j := 1; j <= maxb; j<<=1 {
                n := len(b);
                max := uintptr(1<<28);
                if !*longtest {
-                       max = 1<<22;
+                       max = uintptr(maxb);
                }
                if uintptr(j)*uintptr(n) > max {
                        n = int(max / uintptr(j));
index d09734a130920161786daf27ff9d962faa262d22..4905f6e11fc51704e10f1958b5138c2482577c72 100644 (file)
@@ -11,7 +11,7 @@ import (
        "strconv";
 )
 
-const arraylen = 2; // BUG: shouldn't need this
+const count = 100;
 
 func P(a []string) string {
        s := "{";
@@ -57,7 +57,6 @@ func main() {
        type M map[int] int;
        mipM := make(map[int] M);
 
-       const count = 1000;
        var apT [2*count]*T;
 
        for i := 0; i < count; i++ {
@@ -80,7 +79,7 @@ func main() {
                msi[s] = i;
                mss[s] = s10;
                mss[s] = s10;
-               as := make([]string, arraylen);
+               as := make([]string, 2);
                        as[0] = s10;
                        as[1] = s10;
                mspa[s] = as;
@@ -162,7 +161,7 @@ func main() {
                if mss[s] != s10 {
                        fmt.Printf("mss[%s] = %g\n", s, mss[s]);
                }
-               for j := 0; j < arraylen; j++ {
+               for j := 0; j < len(mspa[s]); j++ {
                        if mspa[s][j] != s10 {
                                fmt.Printf("mspa[%s][%d] = %s\n", s, j, mspa[s][j]);
                        }
index 07e5f0ed370cbaed2823bd3e750e7a83e5fe5e97..ccff66bfef966e6588ba7e5810568abcba93d0e6 100644 (file)
@@ -124,7 +124,7 @@ func verify() {
 func main() {
 
        verify();
-       for i := 0; i <= 10; i++ {
+       for i := 0; i <= 9; i++ {
                print(i, "! = ", count(fact(gen(i))), "\n");
        }
 }
index f8500547ade0929118ec6129a017a230658db494..a86ce4977ebf653888518d007234f6d3c57700b2 100755 (executable)
--- a/test/run
+++ b/test/run
@@ -36,12 +36,13 @@ PATH=/bin:/usr/bin:/usr/local/bin:${GOBIN:-$HOME/bin}:`pwd`
 RUNFILE=/tmp/gorun-$$-$USER
 TMP1FILE=/tmp/gotest1-$$-$USER
 TMP2FILE=/tmp/gotest2-$$-$USER
+TMP3FILE=/tmp/gotest3-$$-$USER
 
 # don't run the machine out of memory: limit individual processes to 4GB.
 # on thresher, 3GB suffices to run the tests; with 2GB, peano fails.
 ulimit -v 4000000
 
-true >pass.out
+true >pass.out >times.out
 
 for dir in . ken chan interface fixedbugs bugs
 do
@@ -52,7 +53,7 @@ do
                export F=$(basename $i .go)
                export D=$dir
                sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|' >$RUNFILE
-               if ! sh $RUNFILE >$TMP1FILE 2>$TMP2FILE
+               if ! /usr/bin/time -p sh -c "sh $RUNFILE >$TMP1FILE 2>$TMP2FILE" 2>$TMP3FILE
                then
                        echo
                        echo "===========" $i
@@ -71,6 +72,7 @@ do
                else
                        echo $i >>pass.out
                fi
+               echo $(awk 'NR==1{print $2}' $TMP3FILE) $D/$F >>times.out
        done
 done | # clean up some stack noise
        egrep -v '^(r[0-9a-z]+|[cfg]s)  +0x'  |
@@ -88,7 +90,7 @@ case $failed in
 1)
        echo FAIL
 esac
-rm  -f $RUNFILE $TMP1FILE $TMP2FILE *.$A $A.out
+rm  -f $RUNFILE $TMP1FILE $TMP2FILE $TMP3FILE *.$A $A.out
 diffmsg=""
 if ! diff run.out golden.out
 then