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>
This commit is contained in:
Josh Bleecher Snyder 2017-04-06 09:56:56 -07:00
parent 7e40ef3876
commit 89b6e5ee0d
1 changed files with 6 additions and 6 deletions

View File

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