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:
parent
7e40ef3876
commit
89b6e5ee0d
|
|
@ -109,7 +109,7 @@ var tests = []struct {
|
||||||
{"BenchmarkReflect", "reflect", false},
|
{"BenchmarkReflect", "reflect", false},
|
||||||
{"BenchmarkTar", "archive/tar", false},
|
{"BenchmarkTar", "archive/tar", false},
|
||||||
{"BenchmarkXML", "encoding/xml", false},
|
{"BenchmarkXML", "encoding/xml", false},
|
||||||
{"BenchmarkMakeBash", "", true},
|
{"BenchmarkStdCmd", "", true},
|
||||||
{"BenchmarkHelloSize", "", false},
|
{"BenchmarkHelloSize", "", false},
|
||||||
{"BenchmarkCmdGoSize", "", true},
|
{"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())
|
fmt.Printf("%s 1 %d ns/op\n", name, time.Since(start).Nanoseconds())
|
||||||
}
|
}
|
||||||
|
|
||||||
func runMakeBash() {
|
func runStdCmd() {
|
||||||
cmd := exec.Command("./make.bash")
|
cmd := exec.Command("go", "build", "-a", "std", "cmd")
|
||||||
cmd.Dir = filepath.Join(runtime.GOROOT(), "src")
|
cmd.Dir = filepath.Join(runtime.GOROOT(), "src")
|
||||||
runCmd("BenchmarkMakeBash", cmd)
|
runCmd("BenchmarkStdCmd", cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runCmdGoSize() {
|
func runCmdGoSize() {
|
||||||
|
|
@ -222,8 +222,8 @@ func runSize(name, file string) {
|
||||||
|
|
||||||
func runBuild(name, dir string) {
|
func runBuild(name, dir string) {
|
||||||
switch name {
|
switch name {
|
||||||
case "BenchmarkMakeBash":
|
case "BenchmarkStdCmd":
|
||||||
runMakeBash()
|
runStdCmd()
|
||||||
return
|
return
|
||||||
case "BenchmarkCmdGoSize":
|
case "BenchmarkCmdGoSize":
|
||||||
runCmdGoSize()
|
runCmdGoSize()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue