bench,gc_latency: use -short to limit gc_latency output
There's only a few measurements we really care about, and
they also seem to actually be less noisy. Even if they
weren't, this reduces the number of measurements reported
by about 80%.
Change-Id: Id1a93c97d74f27eb2b61f6a95bf2452578d4e8c4
Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/568295
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
diff --git a/cmd/bench/gotest.go b/cmd/bench/gotest.go
index 02d1574..ac8b46a 100644
--- a/cmd/bench/gotest.go
+++ b/cmd/bench/gotest.go
@@ -14,7 +14,7 @@
for _, tc := range tcs {
log.Printf("Running Go test benchmarks for %s", tc.Name)
fmt.Printf("toolchain: %s\n", tc.Name)
- err := tc.Do("", "test", "-v", "-run=none", "-bench=.", "-count=5", "golang.org/x/benchmarks/...")
+ err := tc.Do("", "test", "-v", "-run=none", "-short", "-bench=.", "-count=5", "golang.org/x/benchmarks/...")
if err != nil {
return fmt.Errorf("error running gotest with toolchain %s: %w", tc.Name, err)
}
diff --git a/gc_latency/latency.go b/gc_latency/latency.go
index de1afca..3b4e925 100644
--- a/gc_latency/latency.go
+++ b/gc_latency/latency.go
@@ -202,13 +202,19 @@
average, median := time.Duration(lb.total.Nanoseconds()/int64(count)), delays[len(delays)/2]
p29, p39, p49, p59, p69 := lb.delays[int(0.99*delayLen)], delays[int(0.999*delayLen)], delays[int(0.9999*delayLen)], delays[int(0.99999*delayLen)], delays[int(0.999999*delayLen)]
if b != nil {
- b.ReportMetric(float64(average.Nanoseconds()), "ns/op")
- b.ReportMetric(float64(median), "p50-ns")
- b.ReportMetric(float64(p29), "p99-ns")
- b.ReportMetric(float64(p39), "p99.9-ns")
- b.ReportMetric(float64(p49), "p99.99-ns")
- b.ReportMetric(float64(p59), "p99.999-ns")
- b.ReportMetric(float64(p69), "p99.9999-ns")
+ if testing.Short() {
+ b.ReportMetric(0, "ns/op")
+ b.ReportMetric(float64(p59), "p99.999-ns")
+ b.ReportMetric(float64(p69), "p99.9999-ns")
+ } else {
+ b.ReportMetric(float64(average.Nanoseconds()), "ns/op")
+ b.ReportMetric(float64(median), "p50-ns")
+ b.ReportMetric(float64(p29), "p99-ns")
+ b.ReportMetric(float64(p39), "p99.9-ns")
+ b.ReportMetric(float64(p49), "p99.99-ns")
+ b.ReportMetric(float64(p59), "p99.999-ns")
+ b.ReportMetric(float64(p69), "p99.9999-ns")
+ }
if reportWorstFlag {
b.ReportMetric(float64(lb.worst), "worst")
}
diff --git a/gc_latency/latency_test.go b/gc_latency/latency_test.go
index a86d84f..c507ec4 100644
--- a/gc_latency/latency_test.go
+++ b/gc_latency/latency_test.go
@@ -38,6 +38,14 @@
{"global", true},
}
+ if testing.Short() {
+ tcs = []testCase{
+ {"stack", false},
+ {"heap", false},
+ {"global", false},
+ }
+ }
+
for _, tc := range tcs {
lb := &LB{doFluff: tc.withFluff, howAllocated: tc.howAlloc}
b.Run(fmt.Sprintf("how=%s/fluff=%v", tc.howAlloc, tc.withFluff),