From 167261074940c31fb4a9d6fe4e976e442f5eebd0 Mon Sep 17 00:00:00 2001 From: Damian Gryski Date: Sun, 9 Apr 2023 09:41:36 -0700 Subject: [PATCH] testing: move runtime.GC() call to runN to match upstream --- src/testing/benchmark.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testing/benchmark.go b/src/testing/benchmark.go index b7bd106b..53c7fc7b 100644 --- a/src/testing/benchmark.go +++ b/src/testing/benchmark.go @@ -160,6 +160,7 @@ func (b *B) ReportAllocs() { // runN runs a single benchmark for the specified number of iterations. func (b *B) runN(n int) { b.N = n + runtime.GC() b.ResetTimer() b.StartTimer() b.benchFunc(b) @@ -214,7 +215,6 @@ func (b *B) doBench() BenchmarkResult { // of benchmark iterations until the benchmark runs for the requested benchtime. // run1 must have been called on b. func (b *B) launch() { - runtime.GC() // Run the benchmark for at least the specified amount of time. if b.benchTime.n > 0 { b.runN(b.benchTime.n)