golang testing测试
testing包
Benchmarks
func BenchmarkXxx(b *testing.B) {
b.N
b.ResetTimer() // 重置定时器
b.RunParallel() // 并行测试性能
}
以上代码属于基准测试,通过go test加上 -bench flag执行
func BenchmarkXxx(b *testing.B) {
b.N
b.ResetTimer() // 重置定时器
b.RunParallel() // 并行测试性能
}
以上代码属于基准测试,通过go test加上 -bench flag执行