mardi 1 décembre 2020

benchmark existing test

I have a test which takes too much time to execute. I would like to benchmark it and see where are the main bottle necks. I understood I need to make:

func BenchmarkMyTest(b *testing.B) {
// use b.N somewhere
}

and run it with go test -bench=. but I wanted to benchmark existing test, can I wrap it somehow? What will be parameter t *testing.T I'll pass to?

Aucun commentaire:

Enregistrer un commentaire