testing: move runtime.GC() call to runN to match upstream
Этот коммит содержится в:
родитель
e00a2395d9
коммит
1672610749
1 изменённых файлов: 1 добавлений и 1 удалений
|
@ -160,6 +160,7 @@ func (b *B) ReportAllocs() {
|
||||||
// runN runs a single benchmark for the specified number of iterations.
|
// runN runs a single benchmark for the specified number of iterations.
|
||||||
func (b *B) runN(n int) {
|
func (b *B) runN(n int) {
|
||||||
b.N = n
|
b.N = n
|
||||||
|
runtime.GC()
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
b.StartTimer()
|
b.StartTimer()
|
||||||
b.benchFunc(b)
|
b.benchFunc(b)
|
||||||
|
@ -214,7 +215,6 @@ func (b *B) doBench() BenchmarkResult {
|
||||||
// of benchmark iterations until the benchmark runs for the requested benchtime.
|
// of benchmark iterations until the benchmark runs for the requested benchtime.
|
||||||
// run1 must have been called on b.
|
// run1 must have been called on b.
|
||||||
func (b *B) launch() {
|
func (b *B) launch() {
|
||||||
runtime.GC()
|
|
||||||
// Run the benchmark for at least the specified amount of time.
|
// Run the benchmark for at least the specified amount of time.
|
||||||
if b.benchTime.n > 0 {
|
if b.benchTime.n > 0 {
|
||||||
b.runN(b.benchTime.n)
|
b.runN(b.benchTime.n)
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче