💻 Tech
Benchmark tests show performance profiles. In the example below, when you run go test -run none -bench .
, it will show values like the time it took for each operation (e.g., 51.68 ns/op
)
func BenchmarkTest1(b *testing.B) {
var str string
for j := 0; j < b.N; j++ {
str = fmt.Sprint("ola")
}
}