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>
pull/10/head
David Chase 2024-02-29 17:05:04 -05:00
parent 6bceba257e
commit e81011366a
3 changed files with 22 additions and 8 deletions

View File

@ -14,7 +14,7 @@ func goTest(tcs []*toolchain) error {
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)
}

View File

@ -202,13 +202,19 @@ func (lb0 *LB) bench(b *testing.B) {
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")
}

View File

@ -38,6 +38,14 @@ func BenchmarkGCLatency(b *testing.B) {
{"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),