From 89b6e5ee0d83e2b3c5945e5962b7c1ea29d62d1b Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Thu, 6 Apr 2017 09:56:56 -0700 Subject: [PATCH] cmd/compilebench: change MakeBash to StdCmd Instead of running make.bash, run 'go build -a std cmd'. Change the benchmark name to reflect this. This does roughly the same task, namely compile and link all the code in the tree, but with several advantages: * It works cross-platform. * It is a bit faster, while measuring the same fundamentals. * It doesn't measure how fast the bootstrap compiler works, which is irrelevant. * If interrupted, it leaves the current Go installation in a usable state. Change-Id: I469b1d032b48b06e3dea021bd031283bc3a16ff4 Reviewed-on: https://go-review.googlesource.com/39714 Reviewed-by: Matthew Dempsky --- compilebench/main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compilebench/main.go b/compilebench/main.go index 1b53665c..0a9dcbb2 100644 --- a/compilebench/main.go +++ b/compilebench/main.go @@ -109,7 +109,7 @@ var tests = []struct { {"BenchmarkReflect", "reflect", false}, {"BenchmarkTar", "archive/tar", false}, {"BenchmarkXML", "encoding/xml", false}, - {"BenchmarkMakeBash", "", true}, + {"BenchmarkStdCmd", "", true}, {"BenchmarkHelloSize", "", false}, {"BenchmarkCmdGoSize", "", true}, } @@ -174,10 +174,10 @@ func runCmd(name string, cmd *exec.Cmd) { fmt.Printf("%s 1 %d ns/op\n", name, time.Since(start).Nanoseconds()) } -func runMakeBash() { - cmd := exec.Command("./make.bash") +func runStdCmd() { + cmd := exec.Command("go", "build", "-a", "std", "cmd") cmd.Dir = filepath.Join(runtime.GOROOT(), "src") - runCmd("BenchmarkMakeBash", cmd) + runCmd("BenchmarkStdCmd", cmd) } func runCmdGoSize() { @@ -222,8 +222,8 @@ func runSize(name, file string) { func runBuild(name, dir string) { switch name { - case "BenchmarkMakeBash": - runMakeBash() + case "BenchmarkStdCmd": + runStdCmd() return case "BenchmarkCmdGoSize": runCmdGoSize()