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 <mdempsky@google.com>
diff --git a/compilebench/main.go b/compilebench/main.go
index 1b53665..0a9dcbb 100644
--- a/compilebench/main.go
+++ b/compilebench/main.go
@@ -109,7 +109,7 @@
{"BenchmarkReflect", "reflect", false},
{"BenchmarkTar", "archive/tar", false},
{"BenchmarkXML", "encoding/xml", false},
- {"BenchmarkMakeBash", "", true},
+ {"BenchmarkStdCmd", "", true},
{"BenchmarkHelloSize", "", false},
{"BenchmarkCmdGoSize", "", true},
}
@@ -174,10 +174,10 @@
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 runBuild(name, dir string) {
switch name {
- case "BenchmarkMakeBash":
- runMakeBash()
+ case "BenchmarkStdCmd":
+ runStdCmd()
return
case "BenchmarkCmdGoSize":
runCmdGoSize()