golang testing测试

testing包

Benchmarks

func BenchmarkXxx(b *testing.B) {
	b.N
	b.ResetTimer() // 重置定时器
	b.RunParallel() // 并行测试性能
}

以上代码属于基准测试,通过go test加上 -bench flag执行

posted @ 2020-12-08 10:40  azi-v  阅读(107)  评论(0)    收藏  举报