1
0
mirror of https://github.com/golang/go synced 2024-11-21 13:34:39 -07:00

time tests; sort -nr times.out | sed 10q is illuminating.

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
This commit is contained in:
Russ Cox 2009-10-09 11:18:32 -07:00
parent f0bde7c51b
commit ebd27d62fd
9 changed files with 20 additions and 15 deletions

View 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;
}

View File

@ -8,7 +8,7 @@ package main
import "rand"
const Count = 1e6
const Count = 1e5
func
i64rand() int64

View File

@ -8,7 +8,7 @@ package main
import "rand"
const Count = 1e6
const Count = 1e5
func
i64rand() int64

View 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);
}

View 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);

View 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));

View 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]);
}

View 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");
}
}

View File

@ -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