NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
Banchmark === - 简单测试 ~~~ type datamodel struct { Host string `json:"host"` } func BenchmarkSquare(b *testing.B) { b.ResetTimer() for i:=0;i<b.N;i++{ //测试代码 //data :=`{"host":"123456"}` //d := &datamodel{} //json.Unmarshal([]byte(data),d) d := &datamodel{ Host:"1212312", } json.Marshal(d) } b.StopTimer() } ~~~