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  阅读(103)  评论(0编辑  收藏  举报