]> Cypherpunks repositories - gostls13.git/commitdiff
test: speed up chan/select5
authorJosh Bleecher Snyder <josharian@gmail.com>
Tue, 17 Jun 2014 16:07:18 +0000 (09:07 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Tue, 17 Jun 2014 16:07:18 +0000 (09:07 -0700)
No functional changes.

Generating shorter functions improves compilation time. On my laptop, this test's running time goes from 5.5s to 1.5s; the wall clock time to run all tests goes down 1s. On Raspberry Pi, this CL cuts 50s off the wall clock time to run all tests.

Fixes #7503.

LGTM=bradfitz
R=golang-codereviews, bradfitz
CC=golang-codereviews
https://golang.org/cl/72590045

test/chan/select5.go

index f72cfe4b461c2eee647ff4370b06af87d899288c..1081cb29662932831ef8555b380a8ed9640ecf82 100644 (file)
@@ -27,16 +27,16 @@ func main() {
        fmt.Fprintln(out, header)
        a := new(arg)
 
-       // Generate each kind of test as a separate function to avoid
+       // Generate each test as a separate function to avoid
        // hitting the 6g optimizer with one enormous function.
        // If we name all the functions init we don't have to
        // maintain a list of which ones to run.
        do := func(t *template.Template) {
-               fmt.Fprintln(out, `func init() {`)
                for ; next(); a.reset() {
+                       fmt.Fprintln(out, `func init() {`)
                        run(t, a, out)
+                       fmt.Fprintln(out, `}`)
                }
-               fmt.Fprintln(out, `}`)
        }
 
        do(recv)